gcli

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2015 License: MIT Imports: 4 Imported by: 0

README

gcli

MIT License Go Documentation

gcli (formerly cli-init) generates the codes and its directory structure you need to start building CLI tool by Golang right out of the box. All you need is to provide name, command names and framework you want to use.

Usage

To start new command line tool,

$ gcli new [options] NAME

It generates new cli skeleton project. At least, you must provide executable name.

See more usage,

$ gcli help

Example

If you want to create todo CLI application which has add, list and delete command with mitchellh/cli framework,

$ cd $GOPATH/src/github.com/YOUR_NAME
$ gcli new -F mitchellh_cli -c add -c list -c delete todo

You can run go build todo application from beginning.

Support frameworks

gcli generates two types of CLI (you can choose). Flag pattern & Command pattern.

Flag pattern

Flag pattern is the pattern which executable has only flag options (e.g., grep)

$ grep         —i -C 4   "some string" /tmp
 <executable> <options> <arguments>

To generate this pattern, gcli supports,

Command pattern

Command pattern is the pattern which executable has command for change its behavior (e.g., git)

$  git          --no-pager       push      -v               origin master
  <executable> <global options> <command> <command option> <arguments>

To generate this pattern, gcli supports,

Installation

To install, use go get and make install. We tag versions so feel free to checkout that tag and compile.

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

gcli was re-written from scratch. If you prefer old version of gcli, checkout,

$ git checkout v0.1.0

Contribution

  1. Fork (https://github.com/tcnksm/gcli/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the make test command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

Author

Taichi Nakashima

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL