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: about 1 month ago
JSON representation

A Simple and Clear CLI library. Dependency free.

Lists

README

        






A Simple and Clear CLI library. Dependency free.




Awesome

CodeFactor




### 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 main

import (
"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 example

Flags:

-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)