Do not show help for --help
This commit is contained in:
parent
09f9181281
commit
ff5eb6c7c9
|
@ -730,14 +730,14 @@ void ArgumentParser::printHelp(ostream &os) const
|
||||||
// split top-level operations and other configurations
|
// split top-level operations and other configurations
|
||||||
os << "Available operations:";
|
os << "Available operations:";
|
||||||
for (const Argument *arg : m_mainArgs) {
|
for (const Argument *arg : m_mainArgs) {
|
||||||
if (arg->denotesOperation()) {
|
if (arg->denotesOperation() && strcmp(arg->name(), "help")) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
arg->printInfo(os);
|
arg->printInfo(os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << "\nAvailable top-level options:";
|
os << "\nAvailable top-level options:";
|
||||||
for (const Argument *arg : m_mainArgs) {
|
for (const Argument *arg : m_mainArgs) {
|
||||||
if (!arg->denotesOperation()) {
|
if (!arg->denotesOperation() && strcmp(arg->name(), "help")) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
arg->printInfo(os);
|
arg->printInfo(os);
|
||||||
}
|
}
|
||||||
|
@ -746,8 +746,10 @@ void ArgumentParser::printHelp(ostream &os) const
|
||||||
// just show all args if no operations are available
|
// just show all args if no operations are available
|
||||||
os << "Available arguments:";
|
os << "Available arguments:";
|
||||||
for (const Argument *arg : m_mainArgs) {
|
for (const Argument *arg : m_mainArgs) {
|
||||||
os << '\n';
|
if (strcmp(arg->name(), "help")) {
|
||||||
arg->printInfo(os);
|
os << '\n';
|
||||||
|
arg->printInfo(os);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -685,10 +685,6 @@ void ArgumentParserTests::testHelp()
|
||||||
" example: actually not an operation\n"
|
" example: actually not an operation\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Available top-level options:\n"
|
"Available top-level options:\n"
|
||||||
"\e[1m--help, -h\e[0m\n"
|
|
||||||
" shows this information\n"
|
|
||||||
" particularities: mandatory\n"
|
|
||||||
"\n"
|
|
||||||
"\e[1m--files, -f\e[0m\n"
|
"\e[1m--files, -f\e[0m\n"
|
||||||
" specifies the path of the file(s) to be opened\n"
|
" specifies the path of the file(s) to be opened\n"
|
||||||
" \e[1m--sub\e[0m\n"
|
" \e[1m--sub\e[0m\n"
|
||||||
|
|
Loading…
Reference in New Issue