Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -0,0 +1,7 @@
|
||||
Usage: [flags] [commands]
|
||||
|
||||
Flags:
|
||||
-version Print version information
|
||||
|
||||
Commands:
|
||||
help Print help information
|
||||
@@ -0,0 +1,13 @@
|
||||
import cli { Command, CommandFlag }
|
||||
|
||||
fn main() {
|
||||
mut cmd := Command{
|
||||
version: '0.1.0'
|
||||
defaults: struct {
|
||||
help: CommandFlag{true, false}
|
||||
version: CommandFlag{false, true}
|
||||
man: false
|
||||
}
|
||||
}
|
||||
cmd.parse([''])
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Command `foo` has no flag `-man`
|
||||
@@ -0,0 +1,11 @@
|
||||
import cli { Command, CommandFlag }
|
||||
|
||||
fn main() {
|
||||
mut cmd := Command{
|
||||
name: 'foo'
|
||||
defaults: struct {
|
||||
man: CommandFlag{true, false}
|
||||
}
|
||||
}
|
||||
cmd.parse(['foo', '-man'])
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Usage: [flags] [commands]
|
||||
|
||||
Flags:
|
||||
-help Print help information
|
||||
|
||||
Commands:
|
||||
help Print help information
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import cli { Command }
|
||||
import os
|
||||
|
||||
fn main() {
|
||||
mut cmd := Command{}
|
||||
cmd.defaults = struct {
|
||||
man: false
|
||||
}
|
||||
cmd.parse(os.args)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Usage: foo [flags] [commands]
|
||||
|
||||
Flags:
|
||||
-help Print help information
|
||||
-man Print the auto-generated manpage
|
||||
|
||||
Commands:
|
||||
man Print the auto-generated manpage
|
||||
@@ -0,0 +1,11 @@
|
||||
import cli { Command, CommandFlag }
|
||||
|
||||
fn main() {
|
||||
mut cmd := Command{
|
||||
name: 'foo'
|
||||
defaults: struct {
|
||||
help: CommandFlag{false, true}
|
||||
}
|
||||
}
|
||||
cmd.parse(['foo', '-help'])
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
foo version 0.1.0
|
||||
@@ -0,0 +1,13 @@
|
||||
import cli { Command, CommandFlag }
|
||||
|
||||
fn main() {
|
||||
mut cmd := Command{
|
||||
name: 'foo'
|
||||
version: '0.1.0'
|
||||
posix_mode: true
|
||||
defaults: struct {
|
||||
version: CommandFlag{false, true}
|
||||
}
|
||||
}
|
||||
cmd.parse(['foo', '--version'])
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
Usage: cli greet [flags] <name>
|
||||
|
||||
Prints greeting in different languages.
|
||||
|
||||
Flags:
|
||||
-fun '{"uri":"mqtt://broker.emqx.io:1883","topic":"test_emq/1
|
||||
'{"uri":"mqtt://broker.emqx.io:1883","topic":"test_emq/1","filters":[{"producer_id":0,"trace_group":2,"string_id
|
||||
":3001},{"string_id":3002}]}'
|
||||
-help Print help information
|
||||
-man Print the auto-generated manpage
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import cli { Command, Flag }
|
||||
|
||||
mut cmd := Command{
|
||||
name: 'cli'
|
||||
description: 'An example of the cli library.'
|
||||
version: '1.0.0'
|
||||
}
|
||||
mut greet_cmd := Command{
|
||||
name: 'greet'
|
||||
description: 'Prints greeting in different languages.'
|
||||
usage: '<name>'
|
||||
required_args: 1
|
||||
}
|
||||
greet_cmd.add_flag(Flag{
|
||||
flag: .string_array
|
||||
name: 'fun'
|
||||
description: '\'{"uri":"mqtt://broker.emqx.io:1883","topic":"test_emq/1","filters":[{"producer_id":0,"trace_group":2,"string_id":3001},{"string_id":3002}]}\''
|
||||
})
|
||||
cmd.add_command(greet_cmd)
|
||||
cmd.setup()
|
||||
cmd.parse(['cli', 'greet', '-help'])
|
||||
Whitespace-only changes.
+11
@@ -0,0 +1,11 @@
|
||||
import cli { Command }
|
||||
|
||||
fn main() {
|
||||
mut cmd := Command{
|
||||
name: 'cmd'
|
||||
}
|
||||
cmd.add_command(
|
||||
name: 'foo'
|
||||
)
|
||||
cmd.parse(['', 'cmd', 'foo'])
|
||||
}
|
||||
Reference in new issue
Block a user