From c2e353d6afa38d8a3af533b10c9b4bdf0ef3412d Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Tue, 9 Mar 2021 20:58:51 +0300 Subject: [PATCH] fix: do not print out help string if the parameters are correct There was an issue that `talosctl apply config` version was printing out the help even if arguments are correct. Signed-off-by: Artem Chernyshev --- cmd/talosctl/cmd/talos/apply-config.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/talosctl/cmd/talos/apply-config.go b/cmd/talosctl/cmd/talos/apply-config.go index 65279f5b8d..68bb0d4af2 100644 --- a/cmd/talosctl/cmd/talos/apply-config.go +++ b/cmd/talosctl/cmd/talos/apply-config.go @@ -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") } }