[#74] - args for set-context is optional
* argument for set-context is optional, so removing the assignment of args[0] to Name. Already conditionally the args[0] is assigned if passed Change-Id: Ib3232fc19cbaa2cf3dd14b46e910def5d20fed52
This commit is contained in:
parent
f66f94dc80
commit
c26c6e5ac1
@ -60,17 +60,16 @@ func NewCmdConfigSetContext(rootSettings *environment.AirshipCTLSettings) *cobra
|
||||
Example: setContextExample,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
o.Name = args[0]
|
||||
nFlags := cmd.Flags().NFlag()
|
||||
if nFlags == 0 {
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "Context %q not modified. No new options provided.\n", o.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(args) == 1 {
|
||||
//context name is made optional with --current flag added
|
||||
o.Name = args[0]
|
||||
}
|
||||
if o.Name != "" && nFlags == 0 {
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "Context %q not modified. No new options provided.\n", o.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
modified, err := config.RunSetContext(o, rootSettings.Config(), true)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user