#compdef macvisor mvz
# Generated by `mvz completion zsh`.

_macvisor_vms() {
  local -a vms
  vms=(${(f)"$(${words[1]:-mvz} _complete vms 2>/dev/null)"})
  compadd -a vms
}

_macvisor() {
  local -a commands
  commands=(
    'create:Create a VM from a Linux cloud image, a macOS installer, or a template'
    'shell:Open an SSH shell in a VM'
    'ssh:Open an SSH shell in a VM'
    'exec:Run one command in a VM over SSH'
    'ssh-config:Use VMs with ssh, scp and VS Code as <name>.mvz'
    'images:List templates, Linux images and macOS installers you can download'
    'templates:List templates, Linux images and macOS installers you can download'
    'docker:Use a VM'\''s Docker or Podman from this Mac'\''s docker command'
    'kubeconfig:Print or save the kubeconfig of a VM running k3s'
    'wait:Wait until a VM is up and set up'
    'set:Show or change a VM'\''s name, CPUs, memory, disk, network or ISO'
    'clone:Copy a VM, as a full copy, a linked clone, or from a snapshot'
    'export:Copy a VM'\''s bundle to a folder'
    'import:Add a .macvisor bundle to the library'
    'move:Move a VM to another storage location'
    'locations:List storage locations'
    'list:List VMs'
    'ls:List VMs'
    'show:Show a VM'\''s details'
    'info:Show a VM'\''s details'
    'start:Start a VM'
    'stop:Ask a VM'\''s guest to shut down'
    'poweroff:Turn a VM off at once, without shutting down'
    'restart:Restart a VM'
    'suspend:Save a VM'\''s state to disk and stop it'
    'pause:Pause a running VM in memory'
    'resume:Resume a suspended or paused VM'
    'open:Show a running VM'\''s window'
    'ip:Show a VM'\''s network addresses'
    'console:Attach to a VM'\''s serial console'
    'screenshot:Save a VM'\''s display as a JPEG'
    'template:Show or set whether a VM is a template'
    'autostart:Show or set whether a VM starts when you log in'
    'nvram:Show or change a macOS VM'\''s NVRAM variables (boot-args)'
    'discard-state:Discard a suspended VM'\''s saved state'
    'rm:Move a VM or template to the Trash'
    'delete:Move a VM or template to the Trash'
    'ports:List, add or remove port forwards'
    'disks:List, add or remove a VM'\''s additional disks'
    'trim:Return a running Linux VM'\''s unused disk space to the Mac'
    'flatten:Make a VM'\''s disk one self-contained file'
    'nics:List, add or remove a VM'\''s network adapters'
    'networks:List, create or change the networks VMs can join'
    'snapshots:List, take, revert, delete or export snapshots'
    'send:Copy files or folders into a VM'
    'tasks:List, inspect or cancel tasks'
    'service:Check or control the MacVisor background service'
    'license:Show, activate, refresh or deactivate MacVisor'\''s license'
    'completion:Print a shell completion script'
    'version:Print MacVisor'\''s version'
    'help:Show help for a command'
  )
  if (( CURRENT == 2 )); then
    _describe 'command' commands
    return
  fi
  local position=$(( CURRENT - 2 ))
  case ${words[2]} in
    (create)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --balloon --cpus --disk --home --json --location --memory --nested --network --no-agent --no-autologin --no-balloon --no-forward --no-nested --no-rosetta --no-setup --no-ssh-keys --password-file --project --rosetta --runtime --ssh --ssh-key --user --user-data
      else
        _files
      fi
      ;;
    (shell|ssh)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --no-wait --user --wait --workdir
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (exec)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- -- --no-wait --user --wait --workdir
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (ssh-config)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --install --print --uninstall
      else
        _files
      fi
      ;;
    (images|templates)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --location
      elif (( position == 1 )); then
        compadd -- pull add rm
      else
        _files
      fi
      ;;
    (docker)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --remove --use
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (kubeconfig)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --save
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (wait)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --ssh --timeout
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (set)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --balloon --balloon-target --clipboard --cpus --discard-state --disk --iso --json --memory --name --nested --network
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (clone)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --linked --location --snapshot
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (export)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (import)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --location --move
      else
        _files
      fi
      ;;
    (move)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (locations)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      else
        _files
      fi
      ;;
    (list|ls)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      else
        _files
      fi
      ;;
    (show|info)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (start)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --discard-state --headless --json --recovery
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (stop)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (poweroff)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (restart)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (suspend)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (pause)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (resume)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --discard-state --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (open)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (ip)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --wait
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (console)
      if [[ ${words[CURRENT]} == -* ]]; then
        return
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (screenshot)
      if [[ ${words[CURRENT]} == -* ]]; then
        return
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (template)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (autostart)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (nvram)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (discard-state)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (rm|delete)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (ports)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --guest-port --host --host-port --json --name --udp
      elif (( position == 1 )); then
        compadd -- list add remove
      elif (( position == 2 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (disks)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --size
      elif (( position == 1 )); then
        compadd -- list add remove
      elif (( position == 2 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (trim)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (flatten)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (nics)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        compadd -- list add remove
      elif (( position == 2 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (networks)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --allow --clear --deny --host-only --inbound --json --outbound --subnet
      elif (( position == 1 )); then
        compadd -- create rm reserve firewall
      elif (( position == 3 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (snapshots)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --disk-only --json --name --notes --resume
      elif (( position == 1 )); then
        compadd -- list take revert delete export
      elif (( position == 2 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (send)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        _macvisor_vms
      else
        _files
      fi
      ;;
    (tasks)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json
      elif (( position == 1 )); then
        compadd -- status cancel
      else
        _files
      fi
      ;;
    (service)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --tail
      elif (( position == 1 )); then
        compadd -- logs restart install-agent at-logout
      elif (( position == 2 )) && [[ ${words[3]} == at-logout ]]; then
        compadd -- shutdown suspend
      else
        _files
      fi
      ;;
    (license)
      if [[ ${words[CURRENT]} == -* ]]; then
        compadd -- --json --yes
      elif (( position == 1 )); then
        compadd -- activate refresh deactivate
      else
        _files
      fi
      ;;
    (completion)
      if [[ ${words[CURRENT]} == -* ]]; then
        return
      else
        compadd -- zsh bash fish
      fi
      ;;
    (version)
      if [[ ${words[CURRENT]} == -* ]]; then
        return
      else
        _files
      fi
      ;;
    (help)
      if [[ ${words[CURRENT]} == -* ]]; then
        return
      else
        _describe 'command' commands
      fi
      ;;
    (*) _files ;;
  esac
}

compdef _macvisor macvisor mvz
