command/example/testcmd/main.go

18 lines
375 B
Go
Raw Normal View History

2024-11-16 15:15:27 +08:00
package main
import (
"fmt"
"os"
"git.pyer.club/kingecg/command"
)
func main() {
var cmd = command.NewCommand("test", "test command")
cmd.AddArg("arg1", "a", "arg1 description", "default value")
cmd.AddArg("arg2", "b", "arg2 description", "default value")
cmd.AddSubCommand("sub1", "sub1 description")
cmd.Parse(os.Args[1:])
fmt.Println(cmd.GetGlobalOptions())
}