more command tests, added require_command

This commit is contained in:
mpeterv
2014-01-19 15:27:25 +04:00
parent e81aab8a5b
commit bba513802b
2 changed files with 55 additions and 1 deletions

View File

@@ -39,7 +39,8 @@ local Parser = class {
arguments = {},
options = {},
commands = {},
fields = {"name", "description", "target"}
require_command = false,
fields = {"name", "description", "target", "require_command"}
}:include(Declarative)
local Command = Parser:extends {
@@ -448,6 +449,10 @@ function Parser:parse(args)
close(cur_arg)
end
if parser.require_command and #commands > 0 then
parser:error("command is required")
end
format()
return result