Skip to content

Commit eed0bbe

Browse files
committed
feat: Add start prompt to limactl create
Signed-off-by: opjt <[email protected]>
1 parent 88173f0 commit eed0bbe

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

cmd/limactl/start.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,24 @@ func createAction(cmd *cobra.Command, args []string) error {
549549
if len(inst.Errors) > 0 {
550550
return fmt.Errorf("errors inspecting instance: %+v", inst.Errors)
551551
}
552-
if _, err = instance.Prepare(cmd.Context(), inst, ""); err != nil {
552+
ctx := cmd.Context()
553+
if _, err = instance.Prepare(ctx, inst, ""); err != nil {
554+
return err
555+
}
556+
557+
startNow, err := askWhetherToStart()
558+
if err != nil {
553559
return err
554560
}
555-
logrus.Infof("Run `limactl start %s` to start the instance.", inst.Name)
561+
if !startNow {
562+
logrus.Infof("Run `limactl start %s` to start the instance.", inst.Name)
563+
return nil
564+
}
565+
566+
if err := instance.Start(ctx, inst, false, false); err != nil {
567+
return err
568+
}
569+
556570
return nil
557571
}
558572

0 commit comments

Comments
 (0)