mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-29 03:22:18 +00:00
Avoid printing space at the end of line
This commit is contained in:
@@ -8,7 +8,7 @@ describe("tests related to help message generation", function()
|
||||
Usage: foo [-h]
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("does not create extra help options when :prepare is called several times", function()
|
||||
@@ -17,7 +17,7 @@ Options:
|
||||
Usage: foo [-h]
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("uses custom help option ", function()
|
||||
@@ -27,7 +27,7 @@ Options:
|
||||
Usage: foo [/?]
|
||||
|
||||
Options:
|
||||
/? Show this help message and exit. ]], parser:get_help())
|
||||
/? Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("uses description and epilog", function()
|
||||
@@ -68,7 +68,7 @@ Arguments:
|
||||
others Optional.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("creates correct help message for options", function()
|
||||
@@ -86,7 +86,7 @@ Options:
|
||||
-q, --quiet
|
||||
--from <from>
|
||||
--config <config>
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("adds margin for multiline descriptions", function()
|
||||
@@ -106,7 +106,7 @@ Options:
|
||||
-v Sets verbosity level.
|
||||
-v: Report all warnings.
|
||||
-vv: Report all debugging information.
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("shows default values", function()
|
||||
@@ -123,7 +123,7 @@ Usage: foo [-o <o>] [-p <p>] [-h]
|
||||
Options:
|
||||
-o <o> default: a.out
|
||||
-p <p> Port. (default: 8080)
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("does not show default value when show_default == false", function()
|
||||
@@ -142,7 +142,7 @@ Usage: foo [-o <o>] [-p <p>] [-h]
|
||||
Options:
|
||||
-o <o>
|
||||
-p <p> Port.
|
||||
-h, --help Show this help message and exit. ]], parser:get_help())
|
||||
-h, --help Show this help message and exit.]], parser:get_help())
|
||||
end)
|
||||
|
||||
it("creates correct help message for commands", function()
|
||||
@@ -174,7 +174,7 @@ Usage: foo run [--where <where>] [-h]
|
||||
|
||||
Options:
|
||||
--where <where>
|
||||
-h, --help Show this help message and exit. ]], run:get_help())
|
||||
-h, --help Show this help message and exit.]], run:get_help())
|
||||
end)
|
||||
|
||||
it("uses message provided by user", function()
|
||||
|
@@ -167,7 +167,7 @@ do
|
||||
|
||||
if param then
|
||||
local help = self:flag()
|
||||
:description "Show this help message and exit. "
|
||||
:description "Show this help message and exit."
|
||||
:action(function()
|
||||
io.stdout:write(self:get_help() .. "\n")
|
||||
os.exit(0)
|
||||
@@ -581,7 +581,7 @@ function Parser:get_help()
|
||||
table.insert(blocks, self._description)
|
||||
end
|
||||
|
||||
local labels = {"Arguments: ", "Options: ", "Commands: "}
|
||||
local labels = {"Arguments:", "Options:", "Commands:"}
|
||||
|
||||
for i, elements in ipairs{self._arguments, self._options, self._commands} do
|
||||
if #elements > 0 then
|
||||
|
Reference in New Issue
Block a user