mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Improved usage message generation
Put options taking variable number of arguments after positional arguments
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user