Library for writing extendable CLI applications.
import "github.com/waterlink/plugged"
func main() {
plugged.Gateway("appname", "My super cli application.", os.Args)
}
Example usage:
$ ./appname
USAGE: appname command [options]
appname - My super cli application.
Available commands:
- find - Find some stuff.
- activate - Activate stuff.
- help - This help info.
To get help for any of commands you can do `appname help command` or `appname
command --help`.
$ ./appname find --help
# .. here output of `appname-find --help` ..
func main() {
plugged.Plugin("appname", "find", "Find some stuff.", os.Args, handler)
}
func handler(args []string) {
// .. Find some stuff here ..
}
Make sure you have installed plugin on your PATH
and just run:
appname --plugged-install find
Plugin does not necessary need to be written in go
and/or using plugged
library. Instead it is required for a plugin to abide to the following
interface:
appname-find --plugged-description # => Find some stuff.
appname-find --help # => .. help message ..
You will need to have working recent golang
installation (1.5+
at a time of
writing). And the repo needs to be cloned into your GOPATH
.
go test
runs tests.- Please follow TDD.
- Fork it ( https://github.com/waterlink/plugged/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- waterlink - Oleksii Fedorov, creator, maintainer.