Merge branch '212-fix-help-handling' of git://github.com/sruffell/timewarrior into sruffell-212-fix-help-handling

This commit is contained in:
Thomas Lauf 2019-05-07 22:08:23 +02:00
commit 6bb4f981cb
2 changed files with 24 additions and 3 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))