Categorygithub.com/matherique/cmd
repositorypackage
0.0.0-20220222001800-60708bd7811a
Repository: https://github.com/matherique/cmd.git
Documentation: pkg.go.dev

# README

🧰 CMD toolbox

example workflow

a set of tools to create a CLI in go

Usage

package main

import (
  "fmt"
  "os"

  "github.com/matherique/cmd"
)

func main() {
  c := cmd.New("foo")
  c.AddDesc("foot command description")

  sc := cmd.New("bar")
  sc.AddDesc("bar subcommand description")
  
  c.AddSub(sc)
  
  // removing the binary name using os.Args[1:]
  if err := c.Run(os.Args[1:]); err != nil {
    fmt.Fprintln(os.Stderr, err)
    os.Exit(1)
  }
} 

Author

👤 Matheus Henrique