diff --git a/spec/integrity_spec.lua b/spec/integrity_spec.lua
index 6ce3431..a8fa182 100644
--- a/spec/integrity_spec.lua
+++ b/spec/integrity_spec.lua
@@ -77,7 +77,7 @@ Did you mean '--from'?
end)
describe("help messages", function()
- it("generates correct help message", function()
+ it("generates correct help message using help flag", function()
assert.equal([[
Usage: ]]..script..[[ [-h] [-v] [] ...
@@ -91,11 +91,31 @@ Options:
-v, --verbose Sets verbosity level.
Commands:
+ help Show help for commands.
install Install a rock.
]], get_output("--help"))
end)
- it("generates correct help message for command", function()
+ it("generates correct help message using help command", function()
+ assert.equal([[
+Usage: ]]..script..[[ [-h] [-v] [] ...
+
+A testing program.
+
+Arguments:
+ input
+
+Options:
+ -h, --help Show this help message and exit.
+ -v, --verbose Sets verbosity level.
+
+Commands:
+ help Show help for commands.
+ install Install a rock.
+]], get_output("foo help"))
+ end)
+
+ it("generates correct help message for command using help flag", function()
assert.equal([[
Usage: ]]..script..[[ install [-h] [-f ] []
@@ -111,6 +131,23 @@ Options:
--from
]], get_output("foo install --help"))
end)
+
+ it("generates correct help message for command using help command", function()
+ assert.equal([[
+Usage: ]]..script..[[ install [-h] [-f ] []
+
+Install a rock.
+
+Arguments:
+ rock Name of the rock.
+ version Version of the rock.
+
+Options:
+ -h, --help Show this help message and exit.
+ -f , Fetch the rock from this server.
+ --from
+]], get_output("foo help install"))
+ end)
end)
describe("data flow", function()
diff --git a/spec/script.lua b/spec/script.lua
index 5690d3e..4bca67f 100755
--- a/spec/script.lua
+++ b/spec/script.lua
@@ -3,6 +3,7 @@ local Parser = require "argparse"
local parser = Parser()
:description "A testing program."
+ :add_help_command(true)
:require_command(false)
parser:argument "input"