Files
kong/_examples/shell/commandstring/main.go
T
Keilin Olsen 1db2ea27af Move old shell/main to subdirectory
Also update README reference to same
2022-05-18 01:07:21 -07:00

40 lines
876 B
Go

package main
import (
"fmt"
"github.com/alecthomas/kong"
)
var cli struct {
Debug bool `help:"Debug mode."`
Rm struct {
User string `help:"Run as user." short:"u" default:"default"`
Force bool `help:"Force removal." short:"f"`
Recursive bool `help:"Recursively remove files." short:"r"`
Paths []string `arg:"" help:"Paths to remove." type:"path" name:"path"`
} `cmd:"" help:"Remove files."`
Ls struct {
Paths []string `arg:"" optional:"" help:"Paths to list." type:"path"`
} `cmd:"" help:"List paths."`
}
func main() {
ctx := kong.Parse(&cli,
kong.Name("shell"),
kong.Description("A shell-like example app."),
kong.UsageOnError(),
kong.ConfigureHelp(kong.HelpOptions{
Compact: true,
Summary: true,
}))
switch ctx.Command() {
case "rm <path>":
fmt.Println(cli.Rm.Paths, cli.Rm.Force, cli.Rm.Recursive)
case "ls":
}
}