Skip to content

Commit b4df982

Browse files
authored
fix: duplicate usage output (#786)
When a `*pflag.FlagSet` is parsed, it outputs a usage string if the `--help` flag is included. Since Cobra already does this, this behavior needs to be disabled or the usage will be printed twice. --- Since #736 hasn't been release yet, this fix shouldn't appear in the changelog. BEGIN_COMMIT_OVERRIDE feat: new configuration system, config subcommand END_COMMIT_OVERRIDE
1 parent b9f4b24 commit b4df982

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

internal/state/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func (cfg *config) reset() {
8585
cfg.v.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
8686

8787
cfg.fs = pflag.NewFlagSet("hcloud", pflag.ContinueOnError)
88+
cfg.fs.Usage = func() {} // disable usage output
8889
for _, o := range Options {
8990
o.addToFlagSet(cfg.fs)
9091
}

0 commit comments

Comments
 (0)