#compdef distrobox-create

_distrobox-create() {
    local -a options
    local expl
    local state
    # Array of optargs to pass to _arguments for matching and completion
    options=(
        '(-i --image)'{-i,--image}'[Specify image to use for the container]:image:_distrobox_images'
        '(-n --name)'{-n,--name}'[Specify name for the distrobox]:distrobox name:'
        '--hostname[Specify hostname for the distrobox]:hostname:'
        '(-p --pull)'{-p,--pull}'[Pull the image even if it exists locally (implies --yes)]'
        '(-Y --yes)'{-Y,--yes}'[Non-interactive, pull images without asking]'
        '(-r --root)'{-r,--root}'[Launch with root privileges using podman/docker/lilipod]'
        '(-c --clone)'{-c,--clone}'[Name of the distrobox container to use as base for a new container]:clone container name:'
        '(-H --home)'{-H,--home}'[Select a custom HOME directory for the container]:path:_files -/'
        '--volume[Add additional volumes to the container]:volume:_files'
        '(-a --additional-flags)'{-a,--additional-flags}'[Additional flags to pass to the container manager command]:flags:'
        '(-ap --additional-packages)'{-ap,--additional-packages}'[Additional packages to install during setup]:package:'
        '--init-hooks[Commands to execute during container initialization]:command:'
        '--pre-init-hooks[Commands to execute prior to container initialization]:command:'
        '(-I --init)'{-I,--init}'[Use an init system inside the container]'
        '--nvidia[Try to integrate host nVidia drivers into the guest]'
        '--unshare-devsys[Do not share host devices and sysfs dirs from host]'
        '--unshare-groups[Do not forward users additional groups into the container]'
        '--unshare-ipc[Do not share ipc namespace with host]'
        '--unshare-netns[Do not share the net namespace with host]'
        '--unshare-process[Do not share process namespace with host]'
        '--unshare-all[Activate all the unshare flags]'
        '(-C --compatibility)'{-C,--compatibility}'[Show list of compatible images]'
        '(-h --help)'{-h,--help}'[Show this message]'
        '--no-entry[Do not generate a container entry in the application list]'
        '(-d --dry-run)'{-d,--dry-run}'[Only print the container manager command generated]'
        '(-v --verbose)'{-v,--verbose}'[Show more verbosity]'
        '(-V --version)'{-V,--version}'[Show version]'
        '--absolutely-disable-root-password-i-am-really-positively-sure[Skip user password setup, leaving it blank]'
    )
    # Simple logic
    _message -r "Create new distroboxes."
    _arguments \
      '1:containers:->container' \
      '*:options:->options' \
      $options[@]
}

_distrobox-create
