From 8294bedc9b4ee89c58122fceaa44ec22aecced3b Mon Sep 17 00:00:00 2001 From: opjt Date: Sun, 7 Dec 2025 09:25:45 +0900 Subject: [PATCH] feat: Add start prompt to limactl create Signed-off-by: opjt --- cmd/limactl/start.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/cmd/limactl/start.go b/cmd/limactl/start.go index 89c338f7f31..09df743254e 100644 --- a/cmd/limactl/start.go +++ b/cmd/limactl/start.go @@ -549,11 +549,34 @@ func createAction(cmd *cobra.Command, args []string) error { if len(inst.Errors) > 0 { return fmt.Errorf("errors inspecting instance: %+v", inst.Errors) } - if _, err = instance.Prepare(cmd.Context(), inst, ""); err != nil { + ctx := cmd.Context() + if _, err = instance.Prepare(ctx, inst, ""); err != nil { + return err + } + tty, err := cmd.Flags().GetBool("tty") + if err != nil { + return err + } + + startNow := false + if tty { + startNow, err = askWhetherToStart() + if err != nil { + return err + } + } + + if !startNow { + logrus.Infof("Run `limactl start %s` to start the instance.", inst.Name) + return nil + } + + if err := instance.Start(ctx, inst, false, false); err != nil { return err } - logrus.Infof("Run `limactl start %s` to start the instance.", inst.Name) + return nil + } func startAction(cmd *cobra.Command, args []string) error {