'-h' should show help

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2019-05-18 18:40:26 +02:00
parent 6bb4f981cb
commit 037550b791
3 changed files with 26 additions and 7 deletions

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// Copyright 2006 - 2019, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -445,10 +445,9 @@ 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"))
// 'timew <command> --help|-h' should be treated the same as 'timew help <command>'.
// Therefore, '--help|-h' on the command line should always become the command.
else if (alreadyFoundCmd && (raw == "--help" || raw == "-h"))
{
for (auto& b : _args) {
if (b.hasTag("CMD"))