Subcommands can be defined for a more git-like command line app.
packagemainimport("fmt""log""os""github.com/urfave/cli/v2")funcmain(){app:=&cli.App{Commands:[]*cli.Command{{Name:"add",Aliases:[]string{"a"},Usage:"add a task to the list",Action:func(cCtx*cli.Context)error{fmt.Println("added task: ",cCtx.Args().First())returnnil},},{Name:"complete",Aliases:[]string{"c"},Usage:"complete a task on the list",Action:func(cCtx*cli.Context)error{fmt.Println("completed task: ",cCtx.Args().First())returnnil},},{Name:"template",Aliases:[]string{"t"},Usage:"options for task templates",Subcommands:[]*cli.Command{{Name:"add",Usage:"add a new template",Action:func(cCtx*cli.Context)error{fmt.Println("new task template: ",cCtx.Args().First())returnnil},},{Name:"remove",Usage:"remove an existing template",Action:func(cCtx*cli.Context)error{fmt.Println("removed task template: ",cCtx.Args().First())returnnil},},},},},}iferr:=app.Run(os.Args);err!=nil{log.Fatal(err)}}