mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Add coverage gathering
This commit is contained in:
38
spec/script.lua
Executable file
38
spec/script.lua
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env lua
|
||||
local Parser = require "argparse"
|
||||
|
||||
local parser = Parser()
|
||||
:description "A testing program. "
|
||||
:require_command(false)
|
||||
|
||||
parser:argument "input"
|
||||
|
||||
parser:flag "-v" "--verbose"
|
||||
:description "Sets verbosity level. "
|
||||
:target "verbosity"
|
||||
:count "0-2"
|
||||
|
||||
local install = parser:command "install"
|
||||
:description "Install a rock. "
|
||||
|
||||
install:argument "rock"
|
||||
:description "Name of the rock. "
|
||||
|
||||
install:argument "version"
|
||||
:description "Version of the rock. "
|
||||
:args "?"
|
||||
|
||||
install:option "-f" "--from"
|
||||
:description "Fetch the rock from this server. "
|
||||
:target "server"
|
||||
|
||||
parser:get_usage()
|
||||
parser:get_help()
|
||||
local args = parser:parse()
|
||||
|
||||
print(args.input)
|
||||
print(args.verbosity)
|
||||
print(args.install)
|
||||
print(args.rock)
|
||||
print(args.version)
|
||||
print(args.server)
|
Reference in New Issue
Block a user