Last Updated: November 24, 2019
·
5.258K
· tcnksm

The easy way to start building Golang command-line application

tcnksm/cli-init・GitHub

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.

Demo

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.

Usage

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.

Artifacts

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
  • README.md - insctructs application name, synopsis, usage and installation and so on.
  • CHANGELOG.md - shows version release date and its updates.

See more details codegangsta/cli.

Install

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

$ go get -d github.com/tcnksm/cli-init
$ cd $GOPATH/src/github.com/tcnksm/cli-init
$ make install 

Bug & Opinion

Please contact me via twitter or Github Issue