diff options
Diffstat (limited to 'nerv/test/parse_args.lua')
-rw-r--r-- | nerv/test/parse_args.lua | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/nerv/test/parse_args.lua b/nerv/test/parse_args.lua index 7146c3b..0d280a1 100644 --- a/nerv/test/parse_args.lua +++ b/nerv/test/parse_args.lua @@ -1,16 +1,15 @@ -args, opts = nerv.parse_args( - {"arg1", "arg2", "-abcd", "arg3", - "--hehe", "--oh=no", "--uid=43", - "highfive", "--str=hello"}, +local options = {{"abandon", "a", "bool", default = false, desc = "abandon your belief"}, + {"bullshit", "b", "bool", default = false, desc = "start to bullshit"}, + {"cheat", "c", "bool", default = false, desc = "try to cheat"}, + {"delete", "d", "bool", default = false, desc = "remove everything"}, + {"hehe", "h", "bool", default = false, desc = "233333"}, + {"oh", "o", "bool", default = true, desc = "oh yes!"}, + {"uid", nil, "int", desc = "user uid"}, + {"str", nil, "string", desc = "test string"}} - {{"abandon", "a", "bool", default = false, desc = "abandon your belief"}, - {"bullshit", "b", "bool", default = false, desc = "start to bullshit"}, - {"cheat", "c", "bool", default = false, desc = "try to cheat"}, - {"delete", "d", "bool", default = false, desc = "remove everything"}, - {"hehe", "h", "bool", default = false, desc = "233333"}, - {"oh", "o", "bool", default = true, desc = "oh yes!"}, - {"uid", nil, "int", desc = "user uid"}, - {"str", nil, "string", desc = "test string"}} - ) +args, opts = nerv.parse_args({"arg1", "arg2", "-abcd", "arg3", + "--hehe", "--oh=no", "--uid=43", + "highfive", "--str=hello"}, options) +nerv.print_usage(options) print(table.tostring(args), table.tostring(opts)) |