https://github.com/hattya/go.cli
A command line interface framework
https://github.com/hattya/go.cli
cli command-line go
Last synced: 8 months ago
JSON representation
A command line interface framework
- Host: GitHub
- URL: https://github.com/hattya/go.cli
- Owner: hattya
- License: mit
- Created: 2014-09-10T12:51:20.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2025-08-23T09:28:14.000Z (10 months ago)
- Last Synced: 2025-08-24T03:44:06.996Z (10 months ago)
- Topics: cli, command-line, go
- Language: Go
- Homepage:
- Size: 156 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# go.cli
A command line interface framework.
[](https://pkg.go.dev/github.com/hattya/go.cli)
[](https://github.com/hattya/go.cli/actions/workflows/ci.yml)
[](https://ci.appveyor.com/project/hattya/go-cli)
[](https://codecov.io/gh/hattya/go.cli)
## Installation
```console
$ go get github.com/hattya/go.cli
```
## Usage
```go
package main
import (
"os"
"github.com/hattya/go.cli"
)
var app = cli.NewCLI()
func main() {
app.Version = "1.0"
app.Usage = " hello"
app.Add(&cli.Command{
Name: []string{"hello"},
Action: func(ctx *cli.Context) error {
ctx.UI.Println("Hello World!")
return nil
},
})
if err := app.Run(os.Args[1:]); err != nil {
if _, ok := err.(cli.FlagError); ok {
os.Exit(2)
}
os.Exit(1)
}
}
```
## License
go.cli is distributed under the terms of the MIT License.