diff --git a/command/system_gc.go b/command/system_gc.go index 19ed0cbb568..cc01c550755 100644 --- a/command/system_gc.go +++ b/command/system_gc.go @@ -40,6 +40,17 @@ func (c *SystemGCCommand) AutocompleteArgs() complete.Predictor { func (c *SystemGCCommand) Name() string { return "system gc" } func (c *SystemGCCommand) Run(args []string) int { + flags := c.Meta.FlagSet(c.Name(), FlagSetClient) + flags.Usage = func() { c.Ui.Output(c.Help()) } + + if err := flags.Parse(args); err != nil { + return 1 + } + + if args = flags.Args(); len(args) > 0 { + c.Ui.Error("This command takes no arguments") + c.Ui.Error(commandErrorText(c)) + } // Get the HTTP client client, err := c.Meta.Client() diff --git a/command/system_gc_test.go b/command/system_gc_test.go index e5d04ae6be2..4ced9681569 100644 --- a/command/system_gc_test.go +++ b/command/system_gc_test.go @@ -19,7 +19,7 @@ func TestSystemGCCommand_Good(t *testing.T) { defer srv.Shutdown() ui := cli.NewMockUi() - cmd := &SystemGCCommand{Meta: Meta{Ui: ui, flagAddress: url}} + cmd := &SystemGCCommand{Meta: Meta{Ui: ui}} if code := cmd.Run([]string{"-address=" + url}); code != 0 { t.Fatalf("expected exit 0, got: %d; %v", code, ui.ErrorWriter.String()) diff --git a/command/system_reconcile_summaries.go b/command/system_reconcile_summaries.go index a87d4802899..40bd1a24316 100644 --- a/command/system_reconcile_summaries.go +++ b/command/system_reconcile_summaries.go @@ -40,6 +40,17 @@ func (c *SystemReconcileSummariesCommand) AutocompleteArgs() complete.Predictor func (c *SystemReconcileSummariesCommand) Name() string { return "system reconcile summaries" } func (c *SystemReconcileSummariesCommand) Run(args []string) int { + flags := c.Meta.FlagSet(c.Name(), FlagSetClient) + flags.Usage = func() { c.Ui.Output(c.Help()) } + + if err := flags.Parse(args); err != nil { + return 1 + } + + if args = flags.Args(); len(args) > 0 { + c.Ui.Error("This command takes no arguments") + c.Ui.Error(commandErrorText(c)) + } // Get the HTTP client client, err := c.Meta.Client() diff --git a/command/system_reconcile_summaries_test.go b/command/system_reconcile_summaries_test.go index ac478bf2f92..ae50c299ab2 100644 --- a/command/system_reconcile_summaries_test.go +++ b/command/system_reconcile_summaries_test.go @@ -19,7 +19,7 @@ func TestSystemReconcileSummariesCommand_Good(t *testing.T) { defer srv.Shutdown() ui := cli.NewMockUi() - cmd := &SystemReconcileSummariesCommand{Meta: Meta{Ui: ui, flagAddress: url}} + cmd := &SystemReconcileSummariesCommand{Meta: Meta{Ui: ui}} if code := cmd.Run([]string{"-address=" + url}); code != 0 { t.Fatalf("expected exit 0, got: %d; %v", code, ui.ErrorWriter.String())