Пример #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)
	}
}