Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup redundant code in App/Command #1498

Merged
merged 13 commits into from Oct 14, 2022
18 changes: 9 additions & 9 deletions altsrc/json_command_test.go
Expand Up @@ -46,7 +46,7 @@ func TestCommandJSONFileTest(t *testing.T) {
},
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestCommandJSONFileTestGlobalEnvVarWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestCommandJSONFileTestGlobalEnvVarWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestCommandJSONFileTestSpecifiedFlagWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestCommandJSONFileTestSpecifiedFlagWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -212,7 +212,7 @@ func TestCommandJSONFileTestDefaultValueFileWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -244,7 +244,7 @@ func TestCommandJSONFileTestDefaultValueFileWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -278,7 +278,7 @@ func TestCommandJSONFileFlagHasDefaultGlobalEnvJSONSetGlobalEnvWins(t *testing.T
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -312,7 +312,7 @@ func TestCommandJSONFileFlagHasDefaultGlobalEnvJSONSetGlobalEnvWinsNested(t *tes
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down
18 changes: 9 additions & 9 deletions altsrc/toml_command_test.go
Expand Up @@ -34,7 +34,7 @@ func TestCommandTomFileTest(t *testing.T) {
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestCommandTomlFileTestGlobalEnvVarWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestCommandTomlFileTestGlobalEnvVarWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestCommandTomlFileTestSpecifiedFlagWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestCommandTomlFileTestSpecifiedFlagWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestCommandTomlFileTestDefaultValueFileWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestCommandTomlFileTestDefaultValueFileWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -265,7 +265,7 @@ func TestCommandTomlFileFlagHasDefaultGlobalEnvTomlSetGlobalEnvWins(t *testing.T
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -299,7 +299,7 @@ func TestCommandTomlFileFlagHasDefaultGlobalEnvTomlSetGlobalEnvWinsNested(t *tes
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewTomlSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
18 changes: 9 additions & 9 deletions altsrc/yaml_command_test.go
Expand Up @@ -34,7 +34,7 @@ func TestCommandYamlFileTest(t *testing.T) {
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestCommandYamlFileTestGlobalEnvVarWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestCommandYamlFileTestGlobalEnvVarWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestCommandYamlFileTestSpecifiedFlagWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestCommandYamlFileTestSpecifiedFlagWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestCommandYamlFileTestDefaultValueFileWins(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func TestCommandYamlFileTestDefaultValueFileWinsNested(t *testing.T) {
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))

err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -267,7 +267,7 @@ func TestCommandYamlFileFlagHasDefaultGlobalEnvYamlSetGlobalEnvWins(t *testing.T
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func TestCommandYamlFileFlagHasDefaultGlobalEnvYamlSetGlobalEnvWinsNested(t *tes
&cli.StringFlag{Name: "load"}},
}
command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))
err := command.Run(c)
err := command.Run(c, test)

expect(t, err, nil)
}