Last Updated: November 24, 2019
· tcnksm

The easy way to start building Golang command-line application


cli-init is the easy way to start building Golang command-line application with codegangsta/cli. All you need to do is to type application name and its subcommand. You can focus on core function of your application.


Here is demo of how command works.

Demo shows building command-line todo application which has subcommands add, list, delete. You can see artifacts source code on tcnksm/sample-cli-init.


You just type its application name:

$ cli-init [options] [application]

For example, in above demo:

$ cli-init -s add,list,delete todo

You just set sub-commands with -s option and application name.


Here is artifacts which are generated by above commands.

  • main.go - defines main function. It includes application name, version, usage, author name and so on.
  • commands.go - defines sub-commands. It includes subcommand name, usage, function and so on.
  • version.go - defines application version. default value is 0.1.0
  • - insctructs application name, synopsis, usage and installation and so on.
  • - shows version release date and its updates.

See more details codegangsta/cli.


You can install it standard way, you need installation of golang:

$ go get -d
$ cd $GOPATH/src/
$ make install 

Bug & Opinion

Please contact me via twitter or Github Issue