package main import ( "fmt" "github.com/gonuts/commander" ) func main() { // Create a new command cmd := &commander.Command{ Run: runEchoCmd, UsageLine: "echo [OPTIONS] ARG", Short: "echo a string", Long: `Echo prints the specified string to the console. ARG the string to echo.`, } // Define a flag cmd.Flag.Bool("uppercase", false, "convert the string to uppercase") // Parse the command-line arguments err := cmd.Dispatch(nil) if err != nil { fmt.Println(err) } } func runEchoCmd(cmd *commander.Command, args []string) error { // Get the argument and flag values arg := args[0] uppercase := cmd.Flag.Lookup("uppercase").Value.Get().(bool) // Echo the string if uppercase { fmt.Println(strings.ToUpper(arg)) } else { fmt.Println(arg) } return nil }This code defines a `echo` command that takes one argument and one optional flag, `--uppercase`, which, when present, converts the argument string to uppercase before echoing it to the console. Overall, the gonuts/commander package provides a lightweight and flexible way to construct powerful command-line tools in Go.