cli/cmd/vm/vm.go
Snider 90a049b937 refactor(cmd): use shared styles in ai, go, and vm packages
- ai: Replace local task priority/status styles with shared equivalents
- go: Use FormatCoverage() and ProgressLabel() helpers in test output
- vm: Use shared colour constants instead of hardcoded values
- shared: Add FormatTaskStatus(), StatusPrefix(), ProgressLabel() helpers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 01:22:31 +00:00

48 lines
1.4 KiB
Go

// Package vm provides LinuxKit VM management commands.
package vm
import (
"github.com/charmbracelet/lipgloss"
"github.com/host-uk/core/cmd/shared"
"github.com/spf13/cobra"
)
// Style aliases from shared
var (
repoNameStyle = shared.RepoNameStyle
successStyle = shared.SuccessStyle
errorStyle = shared.ErrorStyle
dimStyle = shared.DimStyle
)
// VM-specific styles
var (
varStyle = lipgloss.NewStyle().Foreground(shared.ColourAmber500)
defaultStyle = lipgloss.NewStyle().Foreground(shared.ColourGray500).Italic(true)
)
// AddVMCommands adds container-related commands under 'vm' to the CLI.
func AddVMCommands(root *cobra.Command) {
vmCmd := &cobra.Command{
Use: "vm",
Short: "LinuxKit VM management",
Long: "Manage LinuxKit virtual machines.\n\n" +
"LinuxKit VMs are lightweight, immutable VMs built from YAML templates.\n" +
"They run using qemu or hyperkit depending on your system.\n\n" +
"Commands:\n" +
" run Run a VM from image or template\n" +
" ps List running VMs\n" +
" stop Stop a running VM\n" +
" logs View VM logs\n" +
" exec Execute command in VM\n" +
" templates Manage LinuxKit templates",
}
root.AddCommand(vmCmd)
addVMRunCommand(vmCmd)
addVMPsCommand(vmCmd)
addVMStopCommand(vmCmd)
addVMLogsCommand(vmCmd)
addVMExecCommand(vmCmd)
addVMTemplatesCommand(vmCmd)
}