diff --git a/modules/core/src/cmdparser.cpp b/modules/core/src/cmdparser.cpp index 4e7da0339..795734437 100644 --- a/modules/core/src/cmdparser.cpp +++ b/modules/core/src/cmdparser.cpp @@ -261,6 +261,9 @@ template void CommandLineParser::printParams() { + int col_p = 30; + int col_d = 50; + std::map >::iterator it; std::vector keysVector; std::string buf; @@ -278,12 +281,39 @@ template else if (keysVector[1] != "") buf += "--" + keysVector[1]; if (del_space(it->second[0]) != "") buf += "=[" + del_space(it->second[0]) + "]"; - cout << setw(28) << left << buf; + cout << setw(col_p-2) << left << buf; + + if (buf.length() > col_p-2) + { + cout << endl << " "; + cout << setw(col_p-2) << left << " "; + } buf = ""; if (del_space(it->second[1]) != "") buf += del_space(it->second[1]); - - cout << setw(50) << left << buf << endl; + + while (true) + { + bool tr = (buf.length() >= col_d-2) ? true: false; + int pos; + + if (tr) + { + pos = buf.find_first_of(' '); + while (buf.find_first_of(' ', pos + 1 ) > 0 && pos < col_d-2) pos = buf.find_first_of(' ', pos + 1); + pos++; + cout << setw(col_d-2) << left << buf.substr(0, pos) << endl; + } + else + { + cout << setw(col_d-2) << left << buf<< endl; + break; + } + + buf.erase(0, pos); + cout << " "; + cout << setw(col_p-2) << left << " "; + } } }