Implement string aliases for actions

Added built-in "store_false" action.
This commit is contained in:
mpeterv
2015-10-31 19:09:12 +03:00
parent 4f9841dec6
commit 8343a41dfa
2 changed files with 38 additions and 8 deletions

View File

@@ -96,6 +96,15 @@ describe("actions", function()
assert.same({path = "./first/second/third"}, args)
end)
it("for options allow using strings as actions", function()
local parser = Parser()
parser:flag("--no-foo"):target("foo"):action("store_false")
parser:flag("--no-bar"):target("bar"):action("store_false")
local args = parser:parse{"--no-foo"}
assert.same({foo = false}, args)
end)
it("pass overwrite flag as the fourth argument", function()
local parser = Parser()
local overwrites = {}