#212: "--help" should show help, not considered to be a tag.

This change makes any instance of '--help' on the command line to be made the
command for this particular invocation.
This commit is contained in:
Shaun Ruffell 2019-04-07 16:01:57 -05:00
parent 08c31b3c8c
commit c76d004897
2 changed files with 71 additions and 0 deletions

View file

@ -445,6 +445,23 @@ void CLI::canonicalizeNames ()
alreadyFoundCmd = true;
}
// 'timew <command> --help' should be treated the same as 'timew help
// <command>'. Therefore, "--help" on the command line should always
// become the command.
else if (alreadyFoundCmd && (raw == "--help"))
{
for (auto& b : _args) {
if (b.hasTag("CMD"))
{
b.unTag("CMD");
break;
}
}
a.tag ("CMD");
a.attribute("canonical", canonical);
}
// Hints.
else if (exactMatch ("hint", raw) ||
canonicalize (canonical, "hint", raw))