Categorygithub.com/seastart/cli-go
modulepackage
0.0.2
Repository: https://github.com/seastart/cli-go.git
Documentation: pkg.go.dev

# README

cli-go

中文帮助
a simple library to build golang command line (cli / cmd)apps

go get github.com/seastart/cli-go

concepts

./app [-main_opt1=1] [command] [-cmd_opt1=1] [-cmd_opt2=2] [subcommands/args]

app is the application
command is sub command, no prefix -
opt is options, start with -
one app may have some main options, such as environment config, like main_opt1 of above example
one app may have some commands, like command of above example
one command may have some command options, like cmd_opt1 cmd_opt2 of above example
one command may have some subcommands(arguments), like subcommands of above example

steps (3 step)

  • app := cli.NewCliApp
  • app.AddCommand
  • app.Run

examples

./main
./main -start=2
./main
./main test -start=2
./main list -page=3
./main
./main test live
./main test -start=2 live
// set default env and then run list command
./main -env=prod list -page=3

default help command

each app have a default help command

./main help

TODO

  • support i18n

# Packages

No description provided by the author

# Functions

实例化一个描述为desc,根参数为opts的cli app.
实例化一个描述为desc,根参数为opts,且没有子命令的cli app.

# Constants

No description provided by the author
成功执行.

# Structs

app.
command.
option.

# Type aliases

command执行.