aboutsummaryrefslogtreecommitdiff
path: root/nerv/test
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2016-03-02 14:27:07 +0800
committerDeterminant <ted.sybil@gmail.com>2016-03-02 14:27:07 +0800
commit42608086c666e23ceac0e9046836a8fefe00e5b2 (patch)
tree2166bf14b7722b24f6d9e496d29270ba9bdde864 /nerv/test
parent3b37f42aaec7f7f20353d58f62b8afb2316b3030 (diff)
add `nerv.print_usage(options)`
Diffstat (limited to 'nerv/test')
-rw-r--r--nerv/test/parse_args.lua25
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))