Remove 'aliases' property

Allow setting several names using 'name' property instead, e.g.
':name "-f --foo"' instead of ':aliases {"-f", "--foo"}'.

This change breaks documented interface of 0.3.x.
This commit is contained in:
mpeterv
2015-06-09 22:06:32 +03:00
parent 4320f40844
commit 44fd3b3cb8
3 changed files with 14 additions and 19 deletions

View File

@@ -4,7 +4,7 @@ getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to :pparse()", function()
it("returns true and result on success", function()
local parser = Parser()
parser:option "-s" "--server"
parser:option "-s --server"
local ok, args = parser:pparse{"--server", "foo"}
assert.is_true(ok)
assert.same({server = "foo"}, args)
@@ -20,8 +20,8 @@ describe("tests related to :pparse()", function()
it("still raises an error if it is caused by misconfiguration", function()
local parser = Parser()
parser:option "--foo"
:aliases {1, 2, 3}
assert.has_error(function() parser:pparse{} end)
parser:flag "--foo"
:action(error)
assert.has_error(function() parser:pparse{"--foo"} end)
end)
end)