mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
A command's metadata moves from hand-kept tables into the command itself: an about (docs page, help group, why no --json) set as its Cobra Annotations. msg.commandDocs, commandGroups and withoutJSON are gone; TestDocLinks reads the links from the generated CLI reference, and help output and the reference are byte-identical. AGENTS.md's cli and vm rows point at new doc.go package comments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
838 B
Go
32 lines
838 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/devvmhq/devvm/internal/msg"
|
|
"github.com/devvmhq/devvm/internal/vm"
|
|
)
|
|
|
|
// newStopCmd is devvm stop.
|
|
func newStopCmd(a *app) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "stop",
|
|
Annotations: about{
|
|
docs: "using/vms#restarting-and-stopping", group: groupVM,
|
|
noJSON: "it stops the VM",
|
|
}.annotations(),
|
|
Short: "Stop this folder's VM",
|
|
Long: "Stop this folder's VM and its proxy. " +
|
|
"devvm, devvm restart or a command that needs the VM running starts it again.",
|
|
Example: examples(
|
|
"devvm stop", "stop this folder's VM",
|
|
),
|
|
Args: noArgs,
|
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
return a.env(func(env *vm.Env) error { return vm.Lifecycle{Env: env}.Stop(cmd.Context()) }, msg.StopVMFailed)
|
|
},
|
|
}
|
|
addFolderFlags(cmd, a)
|
|
return cmd
|
|
}
|