Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leaanthony/clir
A Simple and Clear CLI library. Dependency free.
https://github.com/leaanthony/clir
Last synced: 5 days ago
JSON representation
A Simple and Clear CLI library. Dependency free.
- Host: GitHub
- URL: https://github.com/leaanthony/clir
- Owner: leaanthony
- License: mit
- Created: 2019-11-18T19:52:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T21:26:38.000Z (6 months ago)
- Last Synced: 2024-10-14T08:45:13.257Z (about 2 months ago)
- Language: Go
- Homepage:
- Size: 3.04 MB
- Stars: 178
- Watchers: 4
- Forks: 18
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-go - clîr - A Simple and Clear CLI library. Dependency free. (Command Line / Standard CLI)
- awesome-go - clîr - A Simple and Clear CLI library. Dependency free. (Command Line / Standard CLI)
- awesome-go-extra - clir - 11-18T19:52:00Z|2022-04-16T21:08:35Z| (Build Automation / Standard CLI)
- awesome-go-with-stars - clîr - A Simple and Clear CLI library. Dependency free. (Command Line / Standard CLI)
- awesome-go - clîr - A Simple and Clear CLI library. Dependency free. (Command Line / Standard CLI)
- awesome-go - clîr - A Simple and Clear CLI library. Dependency free. (Command Line / Standard CLI)
- awesome-go-cn - clîr
- awesome-go-plus - clîr - A Simple and Clear CLI library. Dependency free. ![stars](https://img.shields.io/badge/stars-181-blue) (Command Line / Standard CLI)
- awesome-go-plus - clîr - A Simple and Clear CLI library. Dependency free. (Command Line / Standard CLI)
README
A Simple and Clear CLI library. Dependency free.
### Features
* Nested Subcommands
* Uses the standard library `flag` package
* Struct based flags
* Positional Args
* Auto-generated help
* Custom banners
* Hidden Subcommands
* Default Subcommand
* Dependency free### Example
```go
package mainimport (
"fmt""github.com/leaanthony/clir"
)func main() {
// Create new cli
cli := clir.NewCli("Flags", "A simple example", "v0.0.1")// Name
name := "Anonymous"
cli.StringFlag("name", "Your name", &name)// Define action for the command
cli.Action(func() error {
fmt.Printf("Hello %s!\n", name)
return nil
})if err := cli.Run(); err != nil {
fmt.Printf("Error encountered: %v\n", err)
}
}
```#### Generated Help
```shell
$ flags --help
Flags v0.0.1 - A simple exampleFlags:
-help
Get help on the 'flags' command.
-name string
Your name
```#### Documentation
The main documentation may be found [here](https://clir.leaanthony.com).
#### License Status
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fleaanthony%2Fclir.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fleaanthony%2Fclir?ref=badge_large)