aboutsummaryrefslogtreecommitdiff
path: root/nerv/test/parse_args.lua
blob: 7146c3bafe6ac3545bc2ca1495b8e4b14c114648 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
args, opts = nerv.parse_args(
                    {"arg1", "arg2", "-abcd", "arg3",
                    "--hehe", "--oh=no", "--uid=43",
                    "highfive", "--str=hello"},

                    {{"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"}}
            )

print(table.tostring(args), table.tostring(opts))