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

42 lines
1.4 KiB
Go

package cli
import (
"github.com/spf13/cobra"
"github.com/devvmhq/devvm/internal/backend/lima"
"github.com/devvmhq/devvm/internal/msg"
)
// newLimactlCmd is devvm limactl: Lima's own command on the lima
// backend's VMs and images.
func newLimactlCmd(a *app) *cobra.Command {
c := &cobra.Command{
Use: "limactl [ARGS...]",
Annotations: about{
docs: "backends/lima#running-limactl", group: groupMachine,
noJSON: "it runs limactl, whose output is limactl's",
}.annotations(),
Short: "Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier",
Long: "Run limactl with ARGS on devvm's own Lima home, where the lima backend's VMs and images live, " +
"passing on every argument, --help included. " +
"A VM started this way runs unconfined, whatever its tier, so start VMs with devvm.",
Example: examples(
"devvm limactl list", "list the lima backend's VMs and images",
"devvm limactl shell devvm-website-71a99b1076d92c", "open a shell in a running VM through Lima",
),
DisableFlagParsing: true,
DisableFlagsInUseLine: true,
RunE: func(_ *cobra.Command, args []string) error {
d, err := a.dirs()
if err == nil {
err = lima.Limactl(d, args)
}
return failed(err, msg.LimactlFailed)
},
}
// --help is limactl's: hidden from devvm's help for this command.
c.Flags().BoolP("help", "h", false, "")
_ = c.Flags().MarkHidden("help")
return c
}