示例#1
0
func TestMain(t *testing.T) {
	// Execute flag registration for every command to verify there are no
	// commands with flag name collisions
	for _, cmd := range cli.Commands() {
		fs := flag.NewFlagSet("", flag.ContinueOnError)
		cli.RegisterCommand(cmd, fs)
	}
}
示例#2
0
func TestMain(t *testing.T) {
	// Execute flag registration for every command to verify there are no
	// commands with flag name collisions
	for _, cmd := range cli.Commands() {
		fs := flag.NewFlagSet("", flag.ContinueOnError)

		// Use fresh context for every command
		ctx, _ := context.WithCancel(context.Background())
		cmd.Register(ctx, fs)
	}
}