Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions cmd/limactl/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Not to be confused with 'limactl copy' ('limactl cp').
ValidArgsFunction: cloneBashComplete,
GroupID: advancedCommand,
}
cloneCommand.Flags().Bool("start", false, "Start the instance after cloning")
editflags.RegisterEdit(cloneCommand, "[limactl edit] ")
return cloneCommand
}
Expand Down Expand Up @@ -98,17 +99,21 @@ func cloneAction(cmd *cobra.Command, args []string) error {
}
}

if !tty {
// use "start" to start it
return nil
}
startNow, err := askWhetherToStart()
start, err := flags.GetBool("start")
if err != nil {
return err
}
if !startNow {

if tty && !flags.Changed("start") {
start, err = askWhetherToStart()
if err != nil {
return err
}
}
if !start {
return nil
}

err = networks.Reconcile(ctx, newInst.Name)
if err != nil {
return err
Expand Down
18 changes: 12 additions & 6 deletions cmd/limactl/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func newEditCommand() *cobra.Command {
ValidArgsFunction: editBashComplete,
GroupID: basicCommand,
}
editCommand.Flags().Bool("start", false, "Start the instance after editing")
editflags.RegisterEdit(editCommand, "")
return editCommand
}
Expand Down Expand Up @@ -140,21 +141,26 @@ func editAction(cmd *cobra.Command, args []string) error {
logrus.Infof("Instance %q configuration edited", inst.Name)
}

if !tty {
// use "start" to start it
return nil
}
if inst == nil {
// edited a limayaml file directly
return nil
}
startNow, err := askWhetherToStart()

start, err := flags.GetBool("start")
if err != nil {
return err
}
if !startNow {

if tty && !flags.Changed("start") {
start, err = askWhetherToStart()
if err != nil {
return err
}
}
if !start {
return nil
}

err = networks.Reconcile(ctx, inst.Name)
if err != nil {
return err
Expand Down
5 changes: 5 additions & 0 deletions cmd/limactl/main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think we should remove --yes from being a global option that shows up in limactl help. start, edit, and clone are the only commands that check the value of the --tty setting, so it really only applies to start now.

So I would make it a local option in those 3 commands, and make it hidden in edit and clone, so it really becomes just a start option.

@AkihiroSuda You seemed to have reservations about making the deprecated option hidden. What is the reason for that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seemed to have reservations about making the deprecated option hidden. What is the reason for that?

Because we have been keeping other deprecated commands/options.
(limactl show-ssh)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I don't understand why this makes sense: the point of deprecation is to transition away from something because it will go away. Keeping it available for new users to discover and use is not helpful.

Only users that already know about these commands (or existing scripts) should continue to use them, but get a warning, so they can transition away before the commands get removed. If there is no intention of removing a command or feature, then there is no point in deprecating it.

Copy link
Member

@jandubois jandubois Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I would make it a local option in those 3 commands, and make it hidden in edit and clone, so it really becomes just a start option.

We definitely need to make it a local option if we don't want to hide the deprecated option. That way we can mark it in the --help output for edit and clone as deprecated (which it isn't right now):

l edit --help
Edit an instance of Lima or a template
...
Global Flags:
...
  -y, --yes                 Alias of --tty=false

But also so that --yes doesn't show up for every single subcommand when it really is just an option for start anymore.

One big reason for getting rid of --yes is to avoid user confusion, and we are not achieving this by keeping it very visible.

Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ func newApp() *cobra.Command {
}

if cmd.Flags().Changed("yes") {
switch cmd.Name() {
case "clone", "edit":
logrus.Warn("--yes flag is deprecated (--tty=false is still supported and works in the same way. Also consider using --start)")
}

// Sets the value of the yesValue flag by using the yes flag.
yesValue, _ := cmd.Flags().GetBool("yes")
if yesValue {
Expand Down