mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Fixed usage messages in subcommands corrupted after several usages
This commit is contained in:
@@ -103,6 +103,23 @@ describe("tests related to usage message generation", function()
|
||||
)
|
||||
end)
|
||||
|
||||
it("usage messages for commands are correct after several :prepare() invocations", function()
|
||||
local parser = Parser "foo"
|
||||
:add_help(false)
|
||||
parser:flag "-q" "--quiet"
|
||||
local run = parser:command "run"
|
||||
:add_help(false)
|
||||
run:option "--where"
|
||||
|
||||
parser:prepare()
|
||||
parser:prepare()
|
||||
|
||||
assert.equal(
|
||||
[=[Usage: foo run [--where <where>]]=],
|
||||
run:prepare():get_usage()
|
||||
)
|
||||
end)
|
||||
|
||||
describe("usage generation can be customized", function()
|
||||
it("uses message provided by user", function()
|
||||
local parser = Parser "foo"
|
||||
|
Reference in New Issue
Block a user