Skip to content

Commit 0e596d8

Browse files
committed
M3: make --state-dir a persistent flag on vm (list/stop/inspect/rm need it too, not just create/run)
1 parent 486cb65 commit 0e596d8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cmd/vm/commands.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ type Actions interface {
2020
// Command builds the `vm` subcommand tree against the given handler.
2121
func Command(h Actions) *cobra.Command {
2222
vmCmd := &cobra.Command{Use: "vm", Short: "Manage macOS VMs"}
23+
// state-dir applies to every subcommand (locating VM records), so make it persistent
24+
vmCmd.PersistentFlags().String("state-dir", "", "VM state root (default $COCOON_MACOS_HOME or ~/.cocoon-macos)")
2325

2426
createCmd := &cobra.Command{
2527
Use: "create [flags] IMAGE",
@@ -93,5 +95,4 @@ func addVMFlags(cmd *cobra.Command) {
9395
cmd.Flags().String("opencore", "", "OpenCore.qcow2 boot loader (required)")
9496
cmd.Flags().String("ovmf-code", "", "OVMF_CODE firmware (required)")
9597
cmd.Flags().String("ovmf-vars", "", "OVMF_VARS template (copied per-VM)")
96-
cmd.Flags().String("state-dir", "", "VM state root (default $COCOON_MACOS_HOME or ~/.cocoon-macos)")
9798
}

0 commit comments

Comments
 (0)