Add hidden command and option aliases

Also auto-add an alias with dashes in place of underscores if an alias
has an underscore.
This commit is contained in:
Paul Ouellette
2019-12-13 21:46:43 -05:00
parent ad404c06ec
commit 20c14453fd
5 changed files with 96 additions and 11 deletions

View File

@@ -311,6 +311,24 @@ Commands:
Usage: foo]], parser:get_help())
end)
it("does not mention hidden option and command aliases", function()
local parser = Parser "foo"
parser:option "--server"
:hidden_name "--from"
parser:command "newname"
:hidden_name "oldname"
assert.equal([[
Usage: foo [-h] [--server <server>] <command> ...
Options:
-h, --help Show this help message and exit.
--server <server>
Commands:
newname]], parser:get_help())
end)
it("supports grouping options", function()
local parser = Parser "foo"
:add_help(false)