Files
w3cjandClaude Opus 5.5 3e81767482 refactor(cli): each command carries its own docs link, group and samples
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]>
2026-11-08 10:05:13 -07:00

32 lines
975 B
Go

package cli
import (
"github.com/spf13/cobra"
"github.com/devvmhq/devvm/internal/msg"
"github.com/devvmhq/devvm/internal/vm"
)
// newRestartCmd is devvm restart.
func newRestartCmd(a *app) *cobra.Command {
cmd := &cobra.Command{
Use: "restart",
Annotations: about{
docs: "using/vms#restarting-and-stopping", group: groupVM,
noJSON: "it restarts the VM",
}.annotations(),
Short: "Restart this folder's VM and open a shell in it",
Long: "Stop this folder's VM, then start it and open a shell in it as devvm does. " +
"Changes that apply only when a VM starts, such as a new size or an agent's folders, apply then.",
Example: examples(
"devvm restart", "restart this folder's VM and open a shell in it",
),
Args: noArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
return a.env(func(env *vm.Env) error { return vm.Launch{Env: env}.Restart(cmd.Context(), vm.Options{}) }, msg.UpFailed)
},
}
addFolderFlags(cmd, a)
return cmd
}