Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpushka committed Sep 25, 2023
1 parent af21e55 commit fe36d8f
Showing 1 changed file with 60 additions and 2 deletions.
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@
# kli
Tiny CLI building tools for go apps

# A Simple CLI library. Dependency free.

### Features

* Nested Subcommands
* Uses the standard library `flag` package
* Auto-generated help
* Custom banners
* Hidden Subcommands
* Default Subcommand
* Dependency free

### Example

```go
package main

import (
"fmt"
"log"

"github.com/layer-3/neodax/finex/pkg/kli"
)

func main() {

// Create new cli
cli := kli.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
```

0 comments on commit fe36d8f

Please sign in to comment.