In usage message, mark arguments as optional if there is a default value

This commit is contained in:
mpeterv
2014-02-20 12:41:27 +04:00
parent 8bc02caae6
commit e99e047c4d
2 changed files with 21 additions and 1 deletions

View File

@@ -40,6 +40,20 @@ describe("tests related to usage message generation", function()
)
end)
it("creates correct usage message for elements with default value", function()
local parser = Parser "foo"
:add_help(false)
parser:argument "output"
:default "a.out"
parser:option "--from" "-f"
:default "there"
assert.equal(
[=[Usage: foo [--from [<from>]] [<output>]]=],
parser:prepare():get_usage()
)
end)
it("creates correct usage message for commands", function()
local parser = Parser "foo"
:add_help(false)