https://github.com/saschagrunert/ccli
Command line parsing in go, with coloring support 🌈
https://github.com/saschagrunert/ccli
colors command-line-parser go
Last synced: 9 months ago
JSON representation
Command line parsing in go, with coloring support 🌈
- Host: GitHub
- URL: https://github.com/saschagrunert/ccli
- Owner: saschagrunert
- License: mit
- Created: 2017-03-09T19:41:27.000Z (almost 9 years ago)
- Default Branch: v2
- Last Pushed: 2025-03-06T11:27:00.000Z (10 months ago)
- Last Synced: 2025-03-29T05:05:49.469Z (10 months ago)
- Topics: colors, command-line-parser, go
- Language: Go
- Homepage:
- Size: 4.04 MB
- Stars: 82
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ccli 🌈
[](https://travis-ci.org/saschagrunert/ccli) [](https://godoc.org/gopkg.in/saschagrunert/ccli.v1) [](http://gopkg.in/saschagrunert/ccli.v1)
## Command line parsing in go, with coloring support
This project uses the already existing go package [cli](https://github.com/urfave/cli) and adds additional coloring
support to it. Some strong defaults are provided as well.

## Usage
Install the package with:
```shell
go get github.com/saschagrunert/ccli
```
Afterwards it can be used like the `cli` package:
```go
package main
import (
"fmt"
"os"
"time"
"github.com/saschagrunert/ccli"
"github.com/urfave/cli/v2"
)
func main() {
app := ccli.NewApp()
app.Name = "AppName"
app.Usage = "App usage..."
app.Version = "0.1.0"
app.Description = "Application description"
app.Copyright = fmt.Sprintf("© %d Some Company", time.Now().Year())
app.Authors = []cli.Author{{Name: "Name", Email: "e@mail.com"}}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "lang",
Value: "english",
Usage: "language for the greeting",
},
}
app.Action = func(c *cli.Context) error {
fmt.Println("boom! I say!")
return nil
}
if err := app.Run(os.Args); err != nil {
os.Exit(1)
}
}
```