Merge "[#74] - args for set-context is optional"
This commit is contained in:
commit
af43008ca2
@ -60,17 +60,16 @@ func NewCmdConfigSetContext(rootSettings *environment.AirshipCTLSettings) *cobra
|
|||||||
Example: setContextExample,
|
Example: setContextExample,
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
o.Name = args[0]
|
|
||||||
nFlags := cmd.Flags().NFlag()
|
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 {
|
if len(args) == 1 {
|
||||||
//context name is made optional with --current flag added
|
//context name is made optional with --current flag added
|
||||||
o.Name = args[0]
|
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)
|
modified, err := config.RunSetContext(o, rootSettings.Config(), true)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user