Improved usage message generation

Put options taking variable number of arguments after positional arguments
This commit is contained in:
mpeterv
2014-08-21 15:24:54 +04:00
parent 8c16eca398
commit b8766c8cdf
2 changed files with 56 additions and 9 deletions

View File

@@ -41,6 +41,21 @@ describe("tests related to usage message generation", function()
)
end)
it("creates correct usage message for options with variable argument count", function()
local parser = Parser "foo"
:add_help(false)
parser:argument "files"
:args "+"
parser:flag "-q" "--quiet"
parser:option "--globals"
:args "*"
assert.equal(
[=[Usage: foo [-q] <files> [<files>] ... [--globals [<globals>] ...]]=],
parser:get_usage()
)
end)
it("creates correct usage message for arguments with default value", function()
local parser = Parser "foo"
:add_help(false)