cli.go is simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line applications in an expressive way.
You can view the API docs here:
http://godoc.org/github.com/codegangsta/cli
`cli.go` is simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line applications in an expressive way.
## Overview
Command line apps are usually so tiny that there is absolutely no reason why your code should *not* be self-documenting. Things like generating help text and parsing command flags/options should not hinder productivity when writing a command line app.
**This is where cli.go comes into play.** cli.go makes command line programming fun, organized, and expressive!
**This is where `cli.go` comes into play.**`cli.go` makes command line programming fun, organized, and expressive!
## Installation
Make sure you have a working Go environment (go 1.1 is *required*). [See the install instructions](http://golang.org/doc/install.html).
Make sure you have a working Go environment (go 1.1+ is *required*). [See the install instructions](http://golang.org/doc/install.html).
To install `cli.go`, simply run:
```
...
...
@@ -25,7 +24,7 @@ export PATH=$PATH:$GOPATH/bin
```
## Getting Started
One of the philosophies behind cli.go is that an API should be playful and full of discovery. So a cli.go app can be as little as one line of code in `main()`.
One of the philosophies behind `cli.go` is that an API should be playful and full of discovery. So a `cli.go` app can be as little as one line of code in `main()`.
Alternatively, you can just document that users should source the generic
`autocomplete/bash_autocomplete` in their bash configuration with `$PROG` set
to the name of their program (as above).
## Contribution Guidelines
Feel free to put up a pull request to fix a bug or maybe add a feature. I will give it a code review and make sure that it does not break backwards compatibility. If I or any other collaborators agree that it is in line with the vision of the project, we will work with you to get the code into a mergeable state and merge it into the master branch.
Usage:"Send json structured log output to a file or '-' for standard output (default: no json output)",
LogFileFlag=cli.StringFlag{
Name:"logfile",
Usage:"Log output file within the data dir (default = no log file generated)",
Value:"",
}
LogToStdErrFlag=cli.BoolFlag{
Name:"logtostderr",
Usage:"Logs are written to standard error instead of to files.",
}
LogVModuleFlag=cli.GenericFlag{
Name:"vmodule",
Usage:"The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a log verbosity level.",
Usage:"Per-module verbosity: comma-separated list of <module>=<level>, where <module> is file literal or a glog pattern",
Value:glog.GetVModule(),
}
BacktraceAtFlag=cli.GenericFlag{
Name:"backtrace_at",
Usage:"If set to a file and line number (e.g., \"block.go:271\") holding a logging statement, a stack trace will be logged",
Name:"backtrace",
Usage:"Request a stack trace at a specific logging statement (e.g. \"block.go:271\")",
Value:glog.GetTraceLocation(),
}
PProfEanbledFlag=cli.BoolFlag{
...
...
@@ -262,37 +247,37 @@ var (
}
PProfPortFlag=cli.IntFlag{
Name:"pprofport",
Usage:"Port on which the profiler should listen",
Usage:"Profile server listening port",
Value:6060,
}
MetricsEnabledFlag=cli.BoolFlag{
Name:metrics.MetricsEnabledFlag,
Usage:"Enables metrics collection and reporting",
Usage:"Enable metrics collection and reporting",
}
// RPC settings
RPCEnabledFlag=cli.BoolFlag{
Name:"rpc",
Usage:"Enable the JSON-RPC server",
Usage:"Enable the HTTP-RPC server",
}
RPCListenAddrFlag=cli.StringFlag{
Name:"rpcaddr",
Usage:"Listening address for the JSON-RPC server",
Usage:"HTTP-RPC server listening interface",
Value:"127.0.0.1",
}
RPCPortFlag=cli.IntFlag{
Name:"rpcport",
Usage:"Port on which the JSON-RPC server should listen",
Usage:"HTTP-RPC server listening port",
Value:8545,
}
RPCCORSDomainFlag=cli.StringFlag{
Name:"rpccorsdomain",
Usage:"Domain on which to send Access-Control-Allow-Origin header",
Usage:"Domains from which to accept cross origin requests (browser enforced)",
Value:"",
}
RpcApiFlag=cli.StringFlag{
Name:"rpcapi",
Usage:"Specify the API's which are offered over the HTTP RPC interface",
Usage:"API's offered over the HTTP-RPC interface",
Value:comms.DefaultHttpRpcApis,
}
IPCDisabledFlag=cli.BoolFlag{
...
...
@@ -301,7 +286,7 @@ var (
}
IPCApiFlag=cli.StringFlag{
Name:"ipcapi",
Usage:"Specify the API's which are offered over the IPC interface",
Usage:"API's offered over the IPC-RPC interface",
Value:comms.DefaultIpcApis,
}
IPCPathFlag=DirectoryFlag{
...
...
@@ -311,7 +296,7 @@ var (
}
ExecFlag=cli.StringFlag{
Name:"exec",
Usage:"Execute javascript statement (only in combination with console/attach)",
Usage:"Execute JavaScript statement (only in combination with console/attach)",
}
// Network Settings
MaxPeersFlag=cli.IntFlag{
...
...
@@ -331,7 +316,7 @@ var (
}
BootnodesFlag=cli.StringFlag{
Name:"bootnodes",
Usage:"Space-separated enode URLs for p2p discovery bootstrap",
Usage:"Space-separated enode URLs for P2P discovery bootstrap",
Value:"",
}
NodeKeyFileFlag=cli.StringFlag{
...
...
@@ -353,19 +338,21 @@ var (
}
WhisperEnabledFlag=cli.BoolFlag{
Name:"shh",
Usage:"Enable whisper",
Usage:"Enable Whisper",
}
// ATM the url is left to the user and deployment to
JSpathFlag=cli.StringFlag{
Name:"jspath",
Usage:"JS root path for loadScript and document root for admin.httpGet",
Usage:"JavaSript root path for `loadScript` and document root for `admin.httpGet`",