mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-10-02 15:12:30 +00:00
Improved command line parsing
The first character after control character is now not required to be a letter
This commit is contained in:
@@ -23,12 +23,12 @@ describe("tests related to help message generation", function()
|
||||
|
||||
it("uses custom help option", function()
|
||||
local parser = Parser "foo"
|
||||
:add_help {aliases = {"\\?"}}
|
||||
:add_help {name = "/?"}
|
||||
assert.equal(table.concat({
|
||||
"Usage: foo [\\?]",
|
||||
"Usage: foo [/?]",
|
||||
"",
|
||||
"Options: ",
|
||||
" \\? Show this help message and exit. "
|
||||
" /? Show this help message and exit. "
|
||||
}, "\r\n"), parser:prepare():get_help())
|
||||
end)
|
||||
|
||||
|
@@ -16,6 +16,14 @@ describe("tests related to options", function()
|
||||
assert.same({server = "foo"}, args)
|
||||
end)
|
||||
|
||||
it("handles non-standard charset", function()
|
||||
local parser = Parser()
|
||||
parser:option "/s"
|
||||
parser:flag "/?"
|
||||
local args = parser:parse{"/s", "foo", "/?"}
|
||||
assert.same({s = "foo", ["?"] = true}, args)
|
||||
end)
|
||||
|
||||
it("handles GNU-style long options", function()
|
||||
local parser = Parser()
|
||||
parser:option("-s", "--server")
|
||||
|
Reference in New Issue
Block a user