File tree Expand file tree Collapse file tree 3 files changed +28
-12
lines changed Expand file tree Collapse file tree 3 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ Not to be confused with 'limactl copy' ('limactl cp').
34
34
ValidArgsFunction : cloneBashComplete ,
35
35
GroupID : advancedCommand ,
36
36
}
37
+ cloneCommand .Flags ().Bool ("start" , false , "Start the instance after cloning" )
37
38
editflags .RegisterEdit (cloneCommand , "[limactl edit] " )
38
39
return cloneCommand
39
40
}
@@ -98,17 +99,21 @@ func cloneAction(cmd *cobra.Command, args []string) error {
98
99
}
99
100
}
100
101
101
- if ! tty {
102
- // use "start" to start it
103
- return nil
104
- }
105
- startNow , err := askWhetherToStart ()
102
+ start , err := flags .GetBool ("start" )
106
103
if err != nil {
107
104
return err
108
105
}
109
- if ! startNow {
106
+
107
+ if tty && ! flags .Changed ("start" ) {
108
+ start , err = askWhetherToStart ()
109
+ if err != nil {
110
+ return err
111
+ }
112
+ }
113
+ if ! start {
110
114
return nil
111
115
}
116
+
112
117
err = networks .Reconcile (ctx , newInst .Name )
113
118
if err != nil {
114
119
return err
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ func newEditCommand() *cobra.Command {
36
36
ValidArgsFunction : editBashComplete ,
37
37
GroupID : basicCommand ,
38
38
}
39
+ editCommand .Flags ().Bool ("start" , false , "Start the instance after editing" )
39
40
editflags .RegisterEdit (editCommand , "" )
40
41
return editCommand
41
42
}
@@ -140,21 +141,26 @@ func editAction(cmd *cobra.Command, args []string) error {
140
141
logrus .Infof ("Instance %q configuration edited" , inst .Name )
141
142
}
142
143
143
- if ! tty {
144
- // use "start" to start it
145
- return nil
146
- }
147
144
if inst == nil {
148
145
// edited a limayaml file directly
149
146
return nil
150
147
}
151
- startNow , err := askWhetherToStart ()
148
+
149
+ start , err := flags .GetBool ("start" )
152
150
if err != nil {
153
151
return err
154
152
}
155
- if ! startNow {
153
+
154
+ if tty && ! flags .Changed ("start" ) {
155
+ start , err = askWhetherToStart ()
156
+ if err != nil {
157
+ return err
158
+ }
159
+ }
160
+ if ! start {
156
161
return nil
157
162
}
163
+
158
164
err = networks .Reconcile (ctx , inst .Name )
159
165
if err != nil {
160
166
return err
Original file line number Diff line number Diff line change @@ -143,6 +143,11 @@ func newApp() *cobra.Command {
143
143
}
144
144
145
145
if cmd .Flags ().Changed ("yes" ) {
146
+ switch cmd .Name () {
147
+ case "clone" , "edit" :
148
+ logrus .Warn ("--yes flag is deprecated (--tty=false is still supported and works in the same way. Also consider using --start)" )
149
+ }
150
+
146
151
// Sets the value of the yesValue flag by using the yes flag.
147
152
yesValue , _ := cmd .Flags ().GetBool ("yes" )
148
153
if yesValue {
You can’t perform that action at this time.
0 commit comments