diff --git a/docs/content/docs/cli/devvm_adopt.md b/docs/content/docs/cli/devvm_adopt.md index 6fced1b5..1b855793 100644 --- a/docs/content/docs/cli/devvm_adopt.md +++ b/docs/content/docs/cli/devvm_adopt.md @@ -7,7 +7,7 @@ Give this folder the VM made for an earlier folder or path ## Synopsis -Give this folder the VM made for an earlier folder at this path, or for this folder before you moved or renamed it, with its files, secrets and allowlist. With VM, its name as devvm ls lists it, devvm moves that VM here from a folder that's gone, such as one you copied to another disk. devvm asks first in a terminal. +Give this folder the VM made for an earlier folder at this path, or for this folder before you moved or renamed it, with its files, secrets and allowlist. With VM, its name as devvm ls lists it, devvm moves that VM here from a folder that's gone, such as one you copied to another disk. devvm asks first in a terminal without --no-input. ```text devvm adopt [VM] [flags] diff --git a/docs/content/docs/cli/devvm_clone.md b/docs/content/docs/cli/devvm_clone.md index 4d5e7f7a..797df9dc 100644 --- a/docs/content/docs/cli/devvm_clone.md +++ b/docs/content/docs/cli/devvm_clone.md @@ -7,7 +7,7 @@ Show or change whether this folder's VM has its own clone of the repo ## Synopsis -Show whether this folder's VM has its own clone of the repo, on, or mounts this folder, off. devvm clone on and devvm clone off make the VM again from its image, after asking in a terminal, then open a shell in it, and devvm keeps its home folder and its settings, while everything else on its disk is lost. On copies the repo's branches into the new clone, and off first offers to fetch the clone's work into this repo, unless you give --no-clone-check. +Show whether this folder's VM has its own clone of the repo, on, or mounts this folder, off. devvm clone on and devvm clone off make the VM again from its image, after asking in a terminal without --no-input, then open a shell in it, and devvm keeps its home folder and its settings, while everything else on its disk is lost. On copies the repo's branches into the new clone, and off first offers to fetch the clone's work into this repo, unless you give --no-clone-check. ```text devvm clone [on|off] [flags] diff --git a/docs/content/docs/cli/devvm_gc.md b/docs/content/docs/cli/devvm_gc.md index fa83cf46..54c305a7 100644 --- a/docs/content/docs/cli/devvm_gc.md +++ b/docs/content/docs/cli/devvm_gc.md @@ -7,7 +7,7 @@ Delete stale images, unused tools, old files and the Nix cache over its cap ## Synopsis -Delete the stale and unfinished images, the shared tools devvm images lists as unused, the files devvm itself no longer needs, and the shared Nix cache's least recently used files while it's over its cap, after listing them and asking in a terminal. Its flags delete more, such as --tool-images for the current shared tool images no VM has. gc never deletes a VM. +Delete the stale and unfinished images, the shared tools devvm images lists as unused, the files devvm itself no longer needs, and the shared Nix cache's least recently used files while it's over its cap, after listing them and asking in a terminal without --no-input. Its flags delete more, such as --tool-images for the current shared tool images no VM has. gc never deletes a VM. ```text devvm gc [--tool-images [TOOL...]] [flags] diff --git a/docs/content/docs/cli/devvm_images_rm.md b/docs/content/docs/cli/devvm_images_rm.md index 698832d4..6269aa6d 100644 --- a/docs/content/docs/cli/devvm_images_rm.md +++ b/docs/content/docs/cli/devvm_images_rm.md @@ -7,7 +7,7 @@ Delete images, by name or by key ## Synopsis -Delete images, each by its name or by the key devvm images shows, after asking in a terminal. Every one must be built, or devvm deletes nothing. VMs made from an image keep working, except on Linux hosts, where devvm refuses an image whose disk VMs use. +Delete images, each by its name or by the key devvm images shows, after asking in a terminal without --no-input.Every one must be built, or devvm deletes nothing. VMs made from an image keep working, except on Linux hosts, where devvm refuses an image whose disk VMs use. ```text devvm images rm IMAGE|KEY... [flags] diff --git a/docs/content/docs/cli/devvm_layer_add.md b/docs/content/docs/cli/devvm_layer_add.md index bbd84ffc..4270d898 100644 --- a/docs/content/docs/cli/devvm_layer_add.md +++ b/docs/content/docs/cli/devvm_layer_add.md @@ -7,7 +7,7 @@ Make this folder's VM again with more layers, then open a shell in it ## Synopsis -Make this folder's VM again from an image with each LAYER added on top, in the order given, then open a shell in it, after asking in a terminal. devvm keeps its home folder, the project folder and its settings, and everything else on its disk is lost. When its image has an agent, devvm first exports the agents' history, unless you give --no-export. +Make this folder's VM again from an image with each LAYER added on top, in the order given, then open a shell in it, after asking in a terminal without --no-input.devvm keeps its home folder, the project folder and its settings, and everything else on its disk is lost. When its image has an agent, devvm first exports the agents' history, unless you give --no-export. ```text devvm layer add LAYER... [flags] diff --git a/docs/content/docs/cli/devvm_layer_rm.md b/docs/content/docs/cli/devvm_layer_rm.md index 56cd1e90..2f3b3536 100644 --- a/docs/content/docs/cli/devvm_layer_rm.md +++ b/docs/content/docs/cli/devvm_layer_rm.md @@ -7,7 +7,7 @@ Make this folder's VM again without some of its layers, then open a shell in it ## Synopsis -Make this folder's VM again from an image without each LAYER, its other layers kept in their order, then open a shell in it, after asking in a terminal. devvm keeps its home folder, the project folder and its settings, and everything else on its disk is lost. When its image has an agent, devvm first exports the agents' history, unless you give --no-export. +Make this folder's VM again from an image without each LAYER, its other layers kept in their order, then open a shell in it, after asking in a terminal without --no-input.devvm keeps its home folder, the project folder and its settings, and everything else on its disk is lost. When its image has an agent, devvm first exports the agents' history, unless you give --no-export. ```text devvm layer rm LAYER... [flags] diff --git a/docs/content/docs/cli/devvm_rebuild.md b/docs/content/docs/cli/devvm_rebuild.md index a66c2ae6..b58185cf 100644 --- a/docs/content/docs/cli/devvm_rebuild.md +++ b/docs/content/docs/cli/devvm_rebuild.md @@ -7,7 +7,7 @@ Build an image again, and delete the old one ## Synopsis -Build an image again from its parent as it is, then delete the stale images no VM uses, the old one and those built on it among them. When images are built on it, devvm asks first in a terminal. +Build an image again from its parent as it is, then delete the stale images no VM uses, the old one and those built on it among them. When images are built on it, devvm asks first in a terminal without --no-input. ```text devvm rebuild IMAGE [flags] diff --git a/docs/content/docs/cli/devvm_rm.md b/docs/content/docs/cli/devvm_rm.md index a89f1461..28bcf625 100644 --- a/docs/content/docs/cli/devvm_rm.md +++ b/docs/content/docs/cli/devvm_rm.md @@ -7,7 +7,7 @@ Delete this folder's VM, or a VM whose folder is gone ## Synopsis -Delete this folder's VM and what devvm keeps for it, or the VM you name when its folder is gone, after asking in a terminal, which --force never answers when its folder is on a disk that isn't connected. When its image has an agent, devvm first exports the agents' history, unless you give --no-export. A --clone VM's work that this repo hasn't fetched is offered for fetching first, unless you give --no-clone-check. +Delete this folder's VM and what devvm keeps for it, or the VM you name when its folder is gone, after asking in a terminal without --no-input, which --force never answers when its folder is on a disk that isn't connected. When its image has an agent, devvm first exports the agents' history, unless you give --no-export. A --clone VM's work that this repo hasn't fetched is offered for fetching first, unless you give --no-clone-check. ```text devvm rm [VM] [flags] diff --git a/docs/content/docs/cli/devvm_secret_rm.md b/docs/content/docs/cli/devvm_secret_rm.md index 0a1f70c4..83c07bf9 100644 --- a/docs/content/docs/cli/devvm_secret_rm.md +++ b/docs/content/docs/cli/devvm_secret_rm.md @@ -7,7 +7,7 @@ Delete a saved secret ## Synopsis -Delete a saved secret, after asking in a terminal. Proxies that are running stop putting it in at once, but what a VM did with it stays done. +Delete a saved secret, after asking in a terminal without --no-input.Proxies that are running stop putting it in at once, but what a VM did with it stays done. ```text devvm secret rm NAME [flags] diff --git a/internal/cli/adopt.go b/internal/cli/adopt.go index 3661cefb..73535995 100644 --- a/internal/cli/adopt.go +++ b/internal/cli/adopt.go @@ -15,7 +15,7 @@ func newAdoptCmd(a *app) *cobra.Command { Short: "Give this folder the VM made for an earlier folder or path", Long: "Give this folder the VM made for an earlier folder at this path, or for this folder before you moved or renamed it, with its files, secrets and allowlist. " + "With VM, its name as devvm ls lists it, devvm moves that VM here from a folder that's gone, such as one you copied to another disk. " + - "devvm asks first in a terminal.", + "devvm asks first in a terminal without --no-input.", Example: examples( "devvm adopt", "give this folder the VM, after asking", "devvm adopt --force", "give it without asking, as a script must", diff --git a/internal/cli/build.go b/internal/cli/build.go index a00a1a32..7a51cc73 100644 --- a/internal/cli/build.go +++ b/internal/cli/build.go @@ -42,7 +42,7 @@ func newRebuildCmd(a *app) *cobra.Command { Short: "Build an image again, and delete the old one", Long: "Build an image again from its parent as it is, then delete the stale images " + "no VM uses, the old one and those built on it among them. " + - "When images are built on it, devvm asks first in a terminal.", + "When images are built on it, devvm asks first in a terminal without --no-input.", Example: examples( "devvm rebuild foo", "build foo again with the newest packages", "devvm rebuild base --force", "rebuild base without asking, as a script must", diff --git a/internal/cli/clone.go b/internal/cli/clone.go index c54727ba..e82b0829 100644 --- a/internal/cli/clone.go +++ b/internal/cli/clone.go @@ -16,7 +16,7 @@ func newCloneCmd(a *app) *cobra.Command { Use: "clone [on|off]", Short: "Show or change whether this folder's VM has its own clone of the repo", Long: "Show whether this folder's VM has its own clone of the repo, on, or mounts this folder, off. " + - "devvm clone on and devvm clone off make the VM again from its image, after asking in a terminal, then open a shell in it, and devvm keeps its home folder and its settings, while everything else on its disk is lost. " + + "devvm clone on and devvm clone off make the VM again from its image, after asking in a terminal without --no-input, then open a shell in it, and devvm keeps its home folder and its settings, while everything else on its disk is lost. " + "On copies the repo's branches into the new clone, and off first offers to fetch the clone's work into this repo, unless you give --no-clone-check.", Example: examples( "devvm clone", "show whether the VM has its own clone of the repo", diff --git a/internal/cli/gc.go b/internal/cli/gc.go index 3af34638..cfe342f3 100644 --- a/internal/cli/gc.go +++ b/internal/cli/gc.go @@ -43,7 +43,7 @@ func newGCCmd(a *app) *cobra.Command { Short: "Delete stale images, unused tools, old files and the Nix cache over its cap", Long: "Delete the stale and unfinished images, the shared tools devvm images lists as unused, " + "the files devvm itself no longer needs, and the shared Nix cache's least recently used files while it's over its cap, " + - "after listing them and asking in a terminal. " + + "after listing them and asking in a terminal without --no-input. " + "Its flags delete more, such as --tool-images for the current shared tool images no VM has. " + "gc never deletes a VM.", Example: examples( diff --git a/internal/cli/images.go b/internal/cli/images.go index 381da07c..429a91a7 100644 --- a/internal/cli/images.go +++ b/internal/cli/images.go @@ -75,7 +75,7 @@ func newImagesRmCmd(a *app) *cobra.Command { c := &cobra.Command{ Use: "rm IMAGE|KEY...", Short: "Delete images, by name or by key", - Long: "Delete images, each by its name or by the key devvm images shows, after asking in a terminal. " + + Long: "Delete images, each by its name or by the key devvm images shows, after asking in a terminal without --no-input." + "Every one must be built, or devvm deletes nothing. " + "VMs made from an image keep working, except on Linux hosts, where devvm refuses an image whose disk VMs use.", Example: examples( diff --git a/internal/cli/layer.go b/internal/cli/layer.go index 6f74d0e3..56a15917 100644 --- a/internal/cli/layer.go +++ b/internal/cli/layer.go @@ -64,7 +64,7 @@ func newLayerAddCmd(a *app) *cobra.Command { cmd := &cobra.Command{ Use: "add LAYER...", Short: "Make this folder's VM again with more layers, then open a shell in it", - Long: "Make this folder's VM again from an image with each LAYER added on top, in the order given, then open a shell in it, after asking in a terminal. " + + Long: "Make this folder's VM again from an image with each LAYER added on top, in the order given, then open a shell in it, after asking in a terminal without --no-input." + "devvm keeps its home folder, the project folder and its settings, and everything else on its disk is lost. " + "When its image has an agent, devvm first exports the agents' history, unless you give --no-export.", Example: examples( @@ -99,7 +99,7 @@ func newLayerRmCmd(a *app) *cobra.Command { cmd := &cobra.Command{ Use: "rm LAYER...", Short: "Make this folder's VM again without some of its layers, then open a shell in it", - Long: "Make this folder's VM again from an image without each LAYER, its other layers kept in their order, then open a shell in it, after asking in a terminal. " + + Long: "Make this folder's VM again from an image without each LAYER, its other layers kept in their order, then open a shell in it, after asking in a terminal without --no-input." + "devvm keeps its home folder, the project folder and its settings, and everything else on its disk is lost. " + "When its image has an agent, devvm first exports the agents' history, unless you give --no-export.", Example: examples( diff --git a/internal/cli/rm.go b/internal/cli/rm.go index 883efe68..51c92cd7 100644 --- a/internal/cli/rm.go +++ b/internal/cli/rm.go @@ -13,7 +13,7 @@ func newRmCmd(a *app) *cobra.Command { cmd := &cobra.Command{ Use: "rm [VM]", Short: "Delete this folder's VM, or a VM whose folder is gone", - Long: "Delete this folder's VM and what devvm keeps for it, or the VM you name when its folder is gone, after asking in a terminal, which --force never answers when its folder is on a disk that isn't connected. " + + Long: "Delete this folder's VM and what devvm keeps for it, or the VM you name when its folder is gone, after asking in a terminal without --no-input, which --force never answers when its folder is on a disk that isn't connected. " + "When its image has an agent, devvm first exports the agents' history, unless you give --no-export. " + "A --clone VM's work that this repo hasn't fetched is offered for fetching first, unless you give --no-clone-check.", Example: examples( diff --git a/internal/cli/secret.go b/internal/cli/secret.go index 75eae6dd..60c5db11 100644 --- a/internal/cli/secret.go +++ b/internal/cli/secret.go @@ -103,7 +103,7 @@ func newSecretRmCmd(a *app) *cobra.Command { cmd := &cobra.Command{ Use: "rm NAME", Short: "Delete a saved secret", - Long: "Delete a saved secret, after asking in a terminal. " + + Long: "Delete a saved secret, after asking in a terminal without --no-input." + "Proxies that are running stop putting it in at once, but what a VM did with it stays done.", Example: examples( "devvm secret rm github", "delete the GitHub token, after asking", diff --git a/internal/cli/setup.go b/internal/cli/setup.go index f4cf8b83..2ad938b0 100644 --- a/internal/cli/setup.go +++ b/internal/cli/setup.go @@ -74,7 +74,8 @@ func (c setupChoice) none() bool { } // setup is devvm setup's run: the UI it prints through, devvm's folders, -// whether its pickers are shown, how it asks for the size, the network +// whether its pickers are shown, the Reporter it asks for the size through +// (the run's UI; tests make their own), how it asks for the network // policy and the agents, and the host the size is checked against. type setup struct { ui *ui.UI @@ -82,19 +83,10 @@ type setup struct { canPick func() bool pickOne func(msg.M, []ui.Choice) int pick func(msg.M, []vm.PickPart) []vm.PickPart - answer func(msg.Question) (string, error) + sizer msg.Reporter host func() (vm.Host, error) } -// answering is the run's UI, asking for values through answer: setup's, -// which tests answer. -type answering struct { - *ui.UI - answer func(msg.Question) (string, error) -} - -func (a answering) Answer(q msg.Question) (string, error) { return a.answer(q) } - // newSetup returns a setup on the run's folders, its UI's pickers and // prompts, on this machine. func newSetup(a *app) setup { @@ -105,7 +97,7 @@ func newSetup(a *app) setup { canPick: u.CanPick, pickOne: u.PickOne, pick: pickParts(u), - answer: u.Answer, + sizer: u, host: func() (vm.Host, error) { return vm.ThisHost(a.host()) }, } } @@ -150,7 +142,7 @@ func (s setup) run(c setupChoice) error { if err != nil { return err } - sc := vm.SizeChoice{Dirs: dirs, Host: host, Reporter: answering{s.ui, s.answer}} + sc := vm.SizeChoice{Dirs: dirs, Host: host, Reporter: s.sizer} if err := sc.Ask(); err != nil { return err } diff --git a/internal/cli/setup_test.go b/internal/cli/setup_test.go index d7ec468a..7b138456 100644 --- a/internal/cli/setup_test.go +++ b/internal/cli/setup_test.go @@ -48,8 +48,8 @@ func setupSandbox(t *testing.T, terminal bool) (setup, paths.Dirs, *[]string) { parts[0].Rows[0].On = true return parts }, - answer: func(q msg.Question) (string, error) { sized = append(sized, q.M().Names()); return "", nil }, - host: func() (vm.Host, error) { return vm.Host{CPUs: 8, MemoryGiB: 32}, nil }, + sizer: &msg.Fake{Terminal: true, OnInfo: u.Info, OnAnswer: func(m msg.M) string { sized = append(sized, m.Names()); return "" }}, + host: func() (vm.Host, error) { return vm.Host{CPUs: 8, MemoryGiB: 32}, nil }, } return s, d, &sized } @@ -223,6 +223,7 @@ func TestSetupConfigSets(t *testing.T) { s, d, sized := setupSandbox(t, true) u, said, _ := testUI() s.ui = u + s.sizer.(*msg.Fake).OnInfo = u.Info config := "network = \"allowlist\"\nfeatures = []\nagents = [\"codex\"]\nlayers = [\"docker\"]\n[size]\ncpus = 2\n" if err := os.MkdirAll(d.Config, 0o700); err != nil { t.Fatal(err) diff --git a/internal/msg/docs.go b/internal/msg/docs.go index d9c2fe3d..199e099a 100644 --- a/internal/msg/docs.go +++ b/internal/msg/docs.go @@ -340,6 +340,7 @@ var docs = map[string]string{ //nolint:gosec // message IDs and pages, not crede "link_setup_invalid": "using/troubleshooting#a-command-fails", "tools_unmounted": "using/troubleshooting#a-shared-tool-doesnt-mount", "size_pending": "using/ports-size#size", + "size_pending_running": "using/ports-size#size", "new_vm_flags_ignored": "getting-started/commands#your-vm", "new_vm_flags_ignored_run": "getting-started/commands#your-vm", "port_not_listed": "using/ports-size#ports", diff --git a/internal/msg/messages_gen.go b/internal/msg/messages_gen.go index b9e9b778..6c9c4513 100644 --- a/internal/msg/messages_gen.go +++ b/internal/msg/messages_gen.go @@ -29,7 +29,7 @@ func AdoptHasVM(vm string) M { return M{id: "adopt_has_vm", vals: []val{{"vm", vm}}} } -// AdoptMoveRefused is [adopt_move_refused]: "To move {{.vm}} to this folder, run devvm adopt {{.vm}} in a terminal to confirm, or devvm adopt {{.vm}} --force." +// AdoptMoveRefused is [adopt_move_refused]: "To move {{.vm}} to this folder, run devvm adopt {{.vm}} in a terminal without --no-input to confirm, or devvm adopt {{.vm}} --force." func AdoptMoveRefused(vm string) M { return M{id: "adopt_move_refused", vals: []val{{"vm", vm}}} } @@ -294,7 +294,7 @@ func AgentSavePlaceholder(path string, vm string) M { return M{id: "agent_save_placeholder", vals: []val{{"path", path}, {"vm", vm}}} } -// AgentSaveRefused is [agent_save_refused]: "devvm agent save shows what changed and asks before it saves. Run it in a terminal." +// AgentSaveRefused is [agent_save_refused]: "devvm agent save shows what changed and asks before it saves. Run it in a terminal without --no-input." func AgentSaveRefused() M { return M{id: "agent_save_refused"} } @@ -2809,7 +2809,7 @@ func RemakeHomeLost(vm string) M { return M{id: "remake_home_lost", vals: []val{{"vm", vm}}} } -// RemakeParentVM is [remake_parent_vm]: "{{.vm}} was made for {{.dir}}, which this folder is inside. To make it again, run {{.command}} in {{.dir}}, or here in a terminal to confirm." +// RemakeParentVM is [remake_parent_vm]: "{{.vm}} was made for {{.dir}}, which this folder is inside. To make it again, run {{.command}} in {{.dir}}, or here in a terminal without --no-input to confirm." func RemakeParentVM(command string, dir string, vm string) M { return M{id: "remake_parent_vm", vals: []val{{"command", command}, {"dir", dir}, {"vm", vm}}} } @@ -2959,7 +2959,7 @@ func RmGoneStopped(dir string, vm string) M { return M{id: "rm_gone_stopped", vals: []val{{"dir", dir}, {"vm", vm}}} } -// RmParentVM is [rm_parent_vm]: "{{.vm}} was made for {{.dir}}, which this folder is inside. To delete it, run devvm rm in {{.dir}}, or here in a terminal to confirm." +// RmParentVM is [rm_parent_vm]: "{{.vm}} was made for {{.dir}}, which this folder is inside. To delete it, run devvm rm in {{.dir}}, or here in a terminal without --no-input to confirm." func RmParentVM(dir string, vm string) M { return M{id: "rm_parent_vm", vals: []val{{"dir", dir}, {"vm", vm}}} } @@ -2989,7 +2989,7 @@ func RmVMLost(vm string) M { return M{id: "rm_vm_lost", vals: []val{{"vm", vm}}} } -// RmVMNotConnected is [rm_vm_not_connected]: "{{.vm}} was made for {{.dir}}, which is on a disk that isn't connected. Connect the disk, or to delete the VM anyway, run devvm rm {{.vm}} in a terminal." +// RmVMNotConnected is [rm_vm_not_connected]: "{{.vm}} was made for {{.dir}}, which is on a disk that isn't connected. Connect the disk, or to delete the VM anyway, run devvm rm {{.vm}} in a terminal without --no-input." func RmVMNotConnected(dir string, vm string) M { return M{id: "rm_vm_not_connected", vals: []val{{"dir", dir}, {"vm", vm}}} } @@ -3164,11 +3164,16 @@ func SizeNotGib(flag string, value string) M { return M{id: "size_not_gib", vals: []val{{"flag", flag}, {"value", value}}} } -// SizePending is [size_pending]: "{{.vm}} gets {{.size}} when it next starts. Run devvm restart to apply it now." +// SizePending is [size_pending]: "{{.vm}} gets {{.size}} when it next starts." func SizePending(size string, vm string) M { return M{id: "size_pending", vals: []val{{"size", size}, {"vm", vm}}} } +// SizePendingRunning is [size_pending_running]: "{{.vm}} gets {{.size}} when it next starts. Run devvm restart to apply it now." +func SizePendingRunning(size string, vm string) M { + return M{id: "size_pending_running", vals: []val{{"size", size}, {"vm", vm}}} +} + // SizeQuestion is [size_question]: "This machine has {{.have_cpus}} CPUs and {{.have_memory}} GiB of memory. Type the CPUs and memory new VMs get, or press Enter to keep the size in brackets." func SizeQuestion(haveCpus string, haveMemory string) M { return M{id: "size_question", vals: []val{{"have_cpus", haveCpus}, {"have_memory", haveMemory}}} @@ -3234,7 +3239,7 @@ func SSHIncludeNeeded(line string) M { return M{id: "ssh_include_needed", vals: []val{{"line", line}}} } -// SSHIncludeYourself is [ssh_include_yourself]: "There's no terminal to ask in, so devvm didn't add the line. Add it yourself, or run the command again with --ssh-config." +// SSHIncludeYourself is [ssh_include_yourself]: "devvm couldn't ask here, so it didn't add the line. Add it yourself, or run the command again with --ssh-config." func SSHIncludeYourself() M { return M{id: "ssh_include_yourself"} } @@ -3584,7 +3589,7 @@ func VMLacks(has string, tool string, vm string) M { return M{id: "vm_lacks", vals: []val{{"has", has}, {"tool", tool}, {"vm", vm}}} } -// VMMovedHere is [vm_moved_here]: "{{.vm}} was made for {{.was}}, and that folder moved here. To move the VM here, run devvm adopt in a terminal to confirm, or devvm adopt --force." +// VMMovedHere is [vm_moved_here]: "{{.vm}} was made for {{.was}}, and that folder moved here. To move the VM here, run devvm adopt in a terminal without --no-input to confirm, or devvm adopt --force." func VMMovedHere(vm string, was string) M { return M{id: "vm_moved_here", vals: []val{{"vm", vm}, {"was", was}}} } @@ -3604,12 +3609,12 @@ func VMOtherFolder(vm string, was string) M { return M{id: "vm_other_folder", vals: []val{{"vm", vm}, {"was", was}}} } -// VMOtherFolderAdopt is [vm_other_folder_adopt]: "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To use it here, run devvm adopt in a terminal to confirm, or devvm adopt --force." +// VMOtherFolderAdopt is [vm_other_folder_adopt]: "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To use it here, run devvm adopt in a terminal without --no-input to confirm, or devvm adopt --force." func VMOtherFolderAdopt(vm string, was string) M { return M{id: "vm_other_folder_adopt", vals: []val{{"vm", vm}, {"was", was}}} } -// VMOtherFolderRm is [vm_other_folder_rm]: "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To confirm that you want to delete it, run devvm rm in a terminal." +// VMOtherFolderRm is [vm_other_folder_rm]: "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To confirm that you want to delete it, run devvm rm in a terminal without --no-input." func VMOtherFolderRm(vm string, was string) M { return M{id: "vm_other_folder_rm", vals: []val{{"vm", vm}, {"was", was}}} } @@ -3659,7 +3664,7 @@ func WidenParentVM(cmd string, dir string, vm string) M { return M{id: "widen_parent_vm", vals: []val{{"cmd", cmd}, {"dir", dir}, {"vm", vm}}} } -// WidenParentVMRefused is [widen_parent_vm_refused]: "{{.vm}} was made for {{.dir}}, which this folder is inside. To give it more access, run {{.cmd}} in {{.dir}}, or here in a terminal to confirm." +// WidenParentVMRefused is [widen_parent_vm_refused]: "{{.vm}} was made for {{.dir}}, which this folder is inside. To give it more access, run {{.cmd}} in {{.dir}}, or here in a terminal without --no-input to confirm." func WidenParentVMRefused(cmd string, dir string, vm string) M { return M{id: "widen_parent_vm_refused", vals: []val{{"cmd", cmd}, {"dir", dir}, {"vm", vm}}} } @@ -4299,6 +4304,7 @@ var specs = map[string]spec{ "size_memory_prompt": {fields: []string{"memory"}}, "size_not_gib": {fields: []string{"flag", "value"}}, "size_pending": {fields: []string{"size", "vm"}}, + "size_pending_running": {fields: []string{"size", "vm"}}, "size_question": {fields: []string{"have_cpus", "have_memory"}}, "space_backend_unknown": {fields: []string{"backend"}}, "space_caches_note": {}, diff --git a/internal/vm/size.go b/internal/vm/size.go index f491f7e1..1ab86da4 100644 --- a/internal/vm/size.go +++ b/internal/vm/size.go @@ -216,7 +216,11 @@ func (e Settings) ShowSize(ctx context.Context, global bool) (SizeShown, error) return SizeShown{}, err } s := SizeShown{Size: t.in.Size, Pending: pendingSize(t.st, t.in.Size)} - if s.Pending != (backend.Size{}) { + switch { + case s.Pending == (backend.Size{}): + case t.in.Status == backend.StatusRunning: + e.Note(msg.SizePendingRunning(SizeText(s.Pending), t.f.Name)) + default: e.Note(msg.SizePending(SizeText(s.Pending), t.f.Name)) } return s, nil diff --git a/locales/en.toml b/locales/en.toml index df4c43f6..0a354ac0 100644 --- a/locales/en.toml +++ b/locales/en.toml @@ -380,7 +380,7 @@ other = "devvm makes {{.vm}} again from {{.image}}, keeping the project folder a [remake_parent_vm] description = "dir is the folder vm was made for, which the folder devvm runs in is inside; command is the command as typed, such as devvm layer add" -other = "{{.vm}} was made for {{.dir}}, which this folder is inside. To make it again, run {{.command}} in {{.dir}}, or here in a terminal to confirm." +other = "{{.vm}} was made for {{.dir}}, which this folder is inside. To make it again, run {{.command}} in {{.dir}}, or here in a terminal without --no-input to confirm." [remake_parent_vm_ask] description = "dir is the folder vm was made for, which the folder devvm runs in is inside" @@ -945,14 +945,14 @@ other = "The {{.backend}} backend's VM names have at most {{.max}} characters, w other = "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. Run devvm rm to delete the VM, or devvm adopt to use it here." [vm_other_folder_rm] -other = "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To confirm that you want to delete it, run devvm rm in a terminal." +other = "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To confirm that you want to delete it, run devvm rm in a terminal without --no-input." [vm_other_folder_adopt] -other = "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To use it here, run devvm adopt in a terminal to confirm, or devvm adopt --force." +other = "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. To use it here, run devvm adopt in a terminal without --no-input to confirm, or devvm adopt --force." [rm_parent_vm] description = "dir is the folder vm was made for, which the folder devvm runs in is inside" -other = "{{.vm}} was made for {{.dir}}, which this folder is inside. To delete it, run devvm rm in {{.dir}}, or here in a terminal to confirm." +other = "{{.vm}} was made for {{.dir}}, which this folder is inside. To delete it, run devvm rm in {{.dir}}, or here in a terminal without --no-input to confirm." [delete_parent_vm] description = "dir is the folder vm was made for, which the folder devvm runs in is inside" @@ -964,7 +964,7 @@ other = "{{.vm}} was made for {{.dir}}, which this folder is inside, and {{.cmd} [widen_parent_vm_refused] description = "dir is the folder vm was made for, which the folder devvm runs in is inside; cmd is the command that gives vm more access, such as devvm network open" -other = "{{.vm}} was made for {{.dir}}, which this folder is inside. To give it more access, run {{.cmd}} in {{.dir}}, or here in a terminal to confirm." +other = "{{.vm}} was made for {{.dir}}, which this folder is inside. To give it more access, run {{.cmd}} in {{.dir}}, or here in a terminal without --no-input to confirm." [delete_other_folder_vm] other = "{{.vm}} was made for an earlier folder at {{.was}}, which was deleted or replaced. It may hold that project's work. Delete it?" @@ -994,7 +994,7 @@ other = "{{.vm}} was made for {{.dir}}, which is gone. It may hold that project' [rm_vm_not_connected] description = "dir is the folder vm was made for, on a disk that isn't connected" -other = "{{.vm}} was made for {{.dir}}, which is on a disk that isn't connected. Connect the disk, or to delete the VM anyway, run devvm rm {{.vm}} in a terminal." +other = "{{.vm}} was made for {{.dir}}, which is on a disk that isn't connected. Connect the disk, or to delete the VM anyway, run devvm rm {{.vm}} in a terminal without --no-input." [delete_not_connected_folder_vm] description = "dir is the folder vm was made for, on a disk that isn't connected" @@ -1012,7 +1012,7 @@ other = "{{.vm}} was made for {{.was}}, and that folder moved here.\nMove the VM [vm_moved_here] description = "was is the path vm's project folder had; the folder devvm runs in is that folder, moved" -other = "{{.vm}} was made for {{.was}}, and that folder moved here. To move the VM here, run devvm adopt in a terminal to confirm, or devvm adopt --force." +other = "{{.vm}} was made for {{.was}}, and that folder moved here. To move the VM here, run devvm adopt in a terminal without --no-input to confirm, or devvm adopt --force." [vms_moved_here] description = "vms is a comma-separated list of VM names, each made for the folder devvm runs in at a path it had before" @@ -1027,7 +1027,7 @@ description = "dir is the folder devvm runs in, which another folder replaced wh other = "The folder at {{.dir}} changed while devvm asked, so devvm didn't move {{.vm}} here. Run the command again." [adopt_move_refused] -other = "To move {{.vm}} to this folder, run devvm adopt {{.vm}} in a terminal to confirm, or devvm adopt {{.vm}} --force." +other = "To move {{.vm}} to this folder, run devvm adopt {{.vm}} in a terminal without --no-input to confirm, or devvm adopt {{.vm}} --force." [adopt_folder_there] description = "dir is the folder vm was made for, which is still there" @@ -1165,6 +1165,10 @@ other = "{{.vm}} has {{.size}}" [size_pending] description = "size is what changes: cpus=6 memory=16GiB" +other = "{{.vm}} gets {{.size}} when it next starts." + +[size_pending_running] +description = "size is what changes: cpus=6 memory=16GiB" other = "{{.vm}} gets {{.size}} when it next starts. Run devvm restart to apply it now." [size_defaults] @@ -1721,7 +1725,7 @@ description = "line is the Include line for ~/.ssh/config" other = "To reach VMs by name with ssh or VS Code's Remote-SSH, ~/.ssh/config needs this line at the top:\n {{.line}}" [ssh_include_yourself] -other = "There's no terminal to ask in, so devvm didn't add the line. Add it yourself, or run the command again with --ssh-config." +other = "devvm couldn't ask here, so it didn't add the line. Add it yourself, or run the command again with --ssh-config." [add_it_now] other = "Add it now?" @@ -2207,7 +2211,7 @@ other = "Save these settings from {{.vm}} into devvm's agent store, for every VM other = "Every VM with these agents runs the hooks, the MCP servers' commands and the plugins you save." [agent_save_refused] -other = "devvm agent save shows what changed and asks before it saves. Run it in a terminal." +other = "devvm agent save shows what changed and asks before it saves. Run it in a terminal without --no-input." [nothing_saved] other = "nothing saved" diff --git a/testdata/script/size.txtar b/testdata/script/size.txtar index 4baec1a8..e869926b 100644 --- a/testdata/script/size.txtar +++ b/testdata/script/size.txtar @@ -83,10 +83,10 @@ stdout '^size.cpus=1$' stdout '^size.memory=3$' exec devvm size stdout '\Acpus=2 memory=8GiB disk=100GiB\n\z' -stderr '^size_pending size=cpus=1 memory=3GiB vm=devvm-web-[0-9a-f]{14}$' +stderr '^size_pending_running size=cpus=1 memory=3GiB vm=devvm-web-[0-9a-f]{14}$' exec devvm size --json stdout '^ "disk_gib": 100,\n "pending": {\n "cpus": 1,\n "memory_gib": 3\n }\n}\n\z' -stderr '^size_pending ' +stderr '^size_pending_running ' # Back to what it has: nothing waits. exec devvm size --cpus 2 --memory 8 stdout '^==> vm_size size=cpus=2 memory=8GiB disk=100GiB vm=devvm-web-[0-9a-f]{14}$' @@ -106,6 +106,8 @@ exec limactl stop $WEB stub_reset exec devvm size --cpus 1 --memory 8 --disk 120GiB stdout '^==> size_pending size=cpus=1 disk=120GiB vm=devvm-web-[0-9a-f]{14}$' +exec devvm size +stderr '^size_pending size=cpus=1 disk=120GiB vm=devvm-web-[0-9a-f]{14}$' stub_calls ! stdout 'limactl edit' stub_reset