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
opt is options
one app may have some main options
one app may have some commands
one command may have some command options
one command main have some subcommands(arguments)

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

TODO

  • support i18n

GitHub

View Github