Reorder properties

Move more common properties to the front of property lists,
so that they can be passed as constructor arguments.
E.g.

parser:option "-p" "--port"
   :description "Port number."
   :default "8080"
   :convert(tonumber)

can now be expressed as

parser:option("-p --port", "Port number.", "8080", tonumber)
This commit is contained in:
mpeterv
2015-06-09 22:24:21 +03:00
parent 44fd3b3cb8
commit 85809c8ad4
4 changed files with 12 additions and 19 deletions

View File

@@ -152,9 +152,7 @@ describe("tests related to options", function()
describe("Options with optional argument", function()
it("handles emptiness correctly", function()
local parser = Parser()
parser:option "-p" "--password" {
args = "?"
}
parser:option("-p --password", "Secure password for special security", nil, nil, "?")
local args = parser:parse({})
assert.same({}, args)
end)