You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my own Python lib called Skal (which does the same thing as this one) inserting the default command in the args before using the library works but is a ugly work around. I tried this in Go also, and it works! But it is still a little unclean:
func main() {
fmt.Println(os.Args)
// Make sure to only add "test" if no other subcommand is set..
os.Args = append(os.Args, "test")
fmt.Println(os.Args)
}
Would it be possible to set which subcommand (or another command) that will be called when no subcommand is specified?
The text was updated successfully, but these errors were encountered:
This can be done by setting Action on the cli.App instance. Here is a snippet from the NewApp() function in the source where we set the default action to the help command:
funcNewApp() *App {
return&App{
Name: os.Args[0],
Usage: "A new cli application",
Version: "0.0.0",
Action: helpCommand.Action,
}
}
This may already be doable..
In my own Python lib called Skal (which does the same thing as this one) inserting the default command in the args before using the library works but is a ugly work around. I tried this in Go also, and it works! But it is still a little unclean:
Would it be possible to set which subcommand (or another command) that will be called when no subcommand is specified?
The text was updated successfully, but these errors were encountered: