suckless, zero-dependency cli builder for go.
- simple as fuck (and therefore easy to use)
- no dependencies (std only)
- commands are just functions
- subcommands with flags
package main
import (
"fmt"
"os"
"github.com/nxtgo/kli"
)
func main() {
app := kli.App{
Name: "app",
Description: "a minimal cli built with kli",
Author: "you",
Version: "1.0.0",
Commands: []kli.Command{
{
Name: "hello",
Description: "say hello",
Category: "greetings",
Run: func(_ []string) error {
fmt.Println("hello, world!")
return nil
},
},
{
Name: "remove",
Aliases: []string{"rm"},
Description: "remove something",
Category: "util",
Run: func(args []string) error {
fmt.Println("removing:", args)
return nil
},
},
},
}
if err := app.Run(os.Args[1:]); err != nil {
os.Exit(1)
}
}
$ app -h
app - a minimal cli built with kli
by you
version 1.0.0
greetings:
hello say hello
util:
remove (rm) remove something
CC0 1.0 (public domain) + ip waiver.