baseFlags do not need to be set (#1127)

This commit is contained in:
Mathew Kamkar
2022-10-26 14:20:13 -07:00
committed by GitHub
parent 7223d9c132
commit b2493b49f7
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -473,8 +473,8 @@ func (conf *Config) updateFromCLI(c *cli.Context, baseFlags []cli.Flag) error {
for _, flag := range c.App.Flags {
flagName := flag.Names()[0]
// the `len(baseFlags) > 0` check is needed because `c.IsSet(...)` is always false in unit tests
if !c.IsSet(flagName) && len(baseFlags) > 0 {
// the `c.App.Name != "test"` check is needed because `c.IsSet(...)` is always false in unit tests
if !c.IsSet(flagName) && c.App.Name != "test" {
continue
}
+1
View File
@@ -38,6 +38,7 @@ func TestGeneratedFlags(t *testing.T) {
require.NoError(t, err)
app := cli.NewApp()
app.Name = "test"
app.Flags = append(app.Flags, generatedFlags...)
set := flag.NewFlagSet("test", 0)