Change no-edit flag to edit

This commit is contained in:
Julio Chana 2017-11-13 11:32:24 +01:00
parent a32da0748d
commit 9ca5f9ac98
No known key found for this signature in database
GPG Key ID: 1BC5AA953EFC7D23
2 changed files with 7 additions and 6 deletions

View File

@ -43,8 +43,8 @@ type CreateInstanceGroupOptions struct {
DryRun bool DryRun bool
// Output type during a DryRun // Output type during a DryRun
Output string Output string
// Do not launch editor when creating an instance group // Launch editor when creating an instance group
NoEditor bool Editor bool
} }
var ( var (
@ -71,6 +71,7 @@ var (
func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command { func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
options := &CreateInstanceGroupOptions{ options := &CreateInstanceGroupOptions{
Role: string(api.InstanceGroupRoleNode), Role: string(api.InstanceGroupRoleNode),
Editor: true,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -98,7 +99,7 @@ func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
// DryRun mode that will print YAML or JSON // DryRun mode that will print YAML or JSON
cmd.Flags().BoolVar(&options.DryRun, "dry-run", options.DryRun, "If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.") cmd.Flags().BoolVar(&options.DryRun, "dry-run", options.DryRun, "If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.")
cmd.Flags().StringVarP(&options.Output, "output", "o", options.Output, "Ouput format. One of json|yaml") cmd.Flags().StringVarP(&options.Output, "output", "o", options.Output, "Ouput format. One of json|yaml")
cmd.Flags().BoolVar(&options.NoEditor, "no-editor", options.NoEditor, "If true, The instance group will be created by default with no option of editing it") cmd.Flags().BoolVar(&options.Editor, "editor", options.Editor, "Default true. If true, an editor will be opened to edit default values.")
return cmd return cmd
} }
@ -182,7 +183,7 @@ func RunCreateInstanceGroup(f *util.Factory, cmd *cobra.Command, args []string,
} }
} }
if !options.NoEditor { if options.Editor {
var ( var (
edit = editor.NewDefaultEditor(editorEnvs) edit = editor.NewDefaultEditor(editorEnvs)
) )

View File

@ -30,7 +30,7 @@ kops create instancegroup
``` ```
--dry-run If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest. --dry-run If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.
--no-editor If true, The instance group will be created by default with no option of editing it --editor Default true. If true, an editor will be opened to edit default values. (default true)
-o, --output string Ouput format. One of json|yaml -o, --output string Ouput format. One of json|yaml
--role string Type of instance group to create (Node,Master,Bastion) (default "Node") --role string Type of instance group to create (Node,Master,Bastion) (default "Node")
--subnet stringSlice Subnets in which to create instance group --subnet stringSlice Subnets in which to create instance group