@@ -2,6 +2,7 @@ package main
22
33import (
44 "fmt"
5+ log "github.com/sirupsen/logrus"
56 "reflect"
67
78 "github.com/mattermost/mattermost-cloud/cmd/cloud/clicontext"
@@ -90,7 +91,9 @@ type updateContextFlags struct {
9091func (f * updateContextFlags ) addFlags (command * cobra.Command ) {
9192 f .createContextFlags .addFlags (command )
9293 command .Flags ().StringVar (& f .Context , "context" , "" , "Name of the context to update" )
93- command .MarkFlagRequired ("context" )
94+ if err := command .MarkFlagRequired ("context" ); err != nil {
95+ log .Fatalf ("failed to mark flag required: %v" , err )
96+ }
9497 command .Flags ().BoolVar (& f .ClearAuth , "clear-auth" , false , "Turns off authentication for this context" )
9598 command .Flags ().BoolVar (& f .ConfirmationRequired , "confirmation-required" , false , "Require confirmation for commands run in this context" )
9699}
@@ -244,8 +247,9 @@ func newCmdContextCreate() *cobra.Command {
244247 }
245248
246249 flags .addFlags (cmd )
247- cmd .MarkFlagRequired ("server-url" )
248-
250+ if err := cmd .MarkFlagRequired ("server-url" ); err != nil {
251+ log .Fatalf ("failed to mark flag required: %v" , err )
252+ }
249253 return cmd
250254}
251255
@@ -255,7 +259,9 @@ type deleteContextFlags struct {
255259
256260func (f * deleteContextFlags ) addFlags (command * cobra.Command ) {
257261 command .Flags ().StringVar (& f .contextName , "context" , "" , "Name of the context to delete" )
258- command .MarkFlagRequired ("context" )
262+ if err := command .MarkFlagRequired ("context" ); err != nil {
263+ log .Fatalf ("failed to mark flag required: %v" , err )
264+ }
259265}
260266
261267func newCmdContextDelete () * cobra.Command {
0 commit comments