Skip to content

Commit

Permalink
fix: do not print out help string if the parameters are correct
Browse files Browse the repository at this point in the history
There was an issue that `talosctl apply config` version was printing out
the help even if arguments are correct.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
  • Loading branch information
Unix4ever authored and talos-bot committed Mar 9, 2021
1 parent 56c95ea commit c2e353d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/talosctl/cmd/talos/apply-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ var applyConfigCmd = &cobra.Command{
)

if len(args) > 0 {
cmd.Help() //nolint:errcheck

if args[0] != "config" && !strings.EqualFold(args[0], "machineconfig") {
cmd.Help() //nolint:errcheck

return fmt.Errorf("unknown positional argument %s", args[0])
} else if cmd.CalledAs() == "apply-config" {
cmd.Help() //nolint:errcheck

return fmt.Errorf("expected no positional arguments")
}
}
Expand Down

0 comments on commit c2e353d

Please sign in to comment.