0 branches
Tree
Top files
Clone with HTTPS:
testdata
cli: drop trailing periods and use 'Print' in default help/version/man descriptions (#27123)
last May 13
2.52 KB
cli_test.v
tests: skip some slow running tests on jobs that do not use tcc (only when the outputs/checked invariants *do not* depend on the used C compiler)
last Dec 7
833 bytes
flag.v
docs: use cmd/tools/find_doc_comments_with_no_dots.v to put some missing dots in the doc comments of public symbols.
last Jul 2
7.78 KB
man.v
cli: drop trailing periods and use 'Print' in default help/version/man descriptions (#27123)
last May 13
3.71 KB
version.v
cli: drop trailing periods and use 'Print' in default help/version/man descriptions (#27123)
last May 13
942 bytes
help.v
cli: drop trailing periods and use 'Print' in default help/version/man descriptions (#27123)
last May 13
4.46 KB
help_test.v
fmt: fix formating a file in an oscillating manner (fix #22223, fix #22026) (#22232)
1 year ago
1.15 KB
man_test.v
fmt: fix formating a file in an oscillating manner (fix #22223, fix #22026) (#22232)
1 year ago
1.66 KB
Description
cli is a command line option parser, that supports
declarative subcommands, each having a separate set of options.
See also the flag module, for a simpler command line option parser,
that supports only options.
Example
module main
import os
import cli
fn main() {
mut app := cli.Command{
name: 'example-app'
description: 'example-app'
execute: fn (cmd cli.Command) ! {
println('hello app')
return
}
commands: [
cli.Command{
name: 'sub'
alias: 's'
execute: fn (cmd cli.Command) ! {
println('hello subcommand')
return
}
},
]
}
app.setup()
app.parse(os.args)
}
Subcommands can set alias to accept a shorter invocation token, for example
example-app s.