#compdef eggs

_eggs () {
  local _command_id=${words[2]}
  local _cur=${words[CURRENT]}
  local -a _command_flags=()

  ## public cli commands & flags
  local -a _all_commands=(
"adapt:adapt monitor resolution for VM only"
"analyze:analyze for syncto"
"calamares:configure calamares or install or configure it"
"config:Configure and install prerequisites deb packages to run it"
"cuckoo:PXE start with proxy-dhcp"
"dad:ask help from daddy - TUI configuration helper"
"export\:deb:export deb/docs/iso to the destination host"
"export\:iso:export iso in the destination host"
"install:krill: the CLI system installer - the egg became a penguin!"
"kill:kill the eggs/free the nest"
"mom:ask help from mommy - TUI helper"
"produce:produce a live image from your system whithout your data"
"status:informations about eggs status"
"syncfrom:restore users and user data from a LUKS volumes"
"syncto:saves users and user data in a LUKS volume inside the iso"
"tools\:clean:clean system log, apt, etc"
"tools\:ppa:add/remove repo"
"tools\:skel:update skel from home configuration"
"tools\:stat:get statistics from sourceforge"
"tools\:yolk:configure eggs to install without internet"
"update:update the Penguins' eggs tool"
"wardrobe\:get:get warorobe"
"wardrobe\:list:list costumes and accessoires in wardrobe"
"wardrobe\:show:show costumes/accessories in wardrobe"
"wardrobe\:wear:wear costume/accessories from wardrobe"
"autocomplete:display autocomplete installation instructions"
"help:Display help for <%= config.bin %>."
"version:"
  )

  _set_flags () {
    case $_command_id in
adapt)
  _command_flags=(
    "--help[Show CLI help.]"
"--verbose[]"
  )
;;

analyze)
  _command_flags=(
    "--help[Show CLI help.]"
"--verbose[verbose]"
  )
;;

calamares)
  _command_flags=(
    "--help[Show CLI help.]"
"--install[install calamares and its dependencies]"
"--nointeractive[no user interaction]"
"--release[release: remove calamares and all its dependencies after the installation]"
"--remove[remove calamares and its dependencies]"
"--theme=-[theme/branding for eggs and calamares]:"
"--verbose[]"
  )
;;

config)
  _command_flags=(
    "--clean[remove old configuration before to create new one]"
"--help[Show CLI help.]"
"--nointeractive[no user interaction]"
"--noicons[no icons]"
"--verbose[verbose]"
  )
;;

cuckoo)
  _command_flags=(
    "--help[Show CLI help.]"
  )
;;

dad)
  _command_flags=(
    "--clean[remove old configuration before to create]"
"--default[remove old configuration and force default]"
"--help[Show CLI help.]"
"--verbose[]"
  )
;;

export:deb)
  _command_flags=(
    "--all[export all archs]"
"--clean[remove old .deb before to copy]"
"--help[Show CLI help.]"
"--verbose[verbose]"
  )
;;

export:iso)
  _command_flags=(
    "--clean[delete old ISOs before to copy]"
"--help[Show CLI help.]"
"--verbose[verbose]"
  )
;;

install)
  _command_flags=(
    "--crypted[Crypted CLI installation]"
"--custom=-[custom unattended configuration]:"
"--domain=-[Domain name, defult: .local]:"
"--halt[Halt the system after installation]"
"--help[Show CLI help.]"
"--ip[hostname as ip, eg: ip-192-168-1-33]"
"--nointeractive[no user interaction]"
"--none[Swap none: 256M]"
"--pve[Proxmox VE install]"
"--random[Add random to hostname, eg: colibri-ay412dt]"
"--small[Swap small: RAM]"
"--suspend[Swap suspend: RAM x 2]"
"--unattended[Unattended installation]"
"--verbose[Verbose]"
  )
;;

kill)
  _command_flags=(
    "--help[Show CLI help.]"
"--nointeractive[no user interaction]"
"--verbose[verbose]"
  )
;;

mom)
  _command_flags=(
    "--help[Show CLI help.]"
  )
;;

produce)
  _command_flags=(
    "--addons=-[addons to be used: adapt, ichoice, pve, rsupport]:"
"--basename=-[basename]:"
"--clone[clone]"
"--cryptedclone[crypted clone]"
"--help[Show CLI help.]"
"--max[max compression]"
"--nointeractive[no user interaction]"
"--noicons[no icons on desktop]"
"--prefix=-[prefix]:"
"--release[release: max compression, remove penguins-eggs and calamares after installation]"
"--script[script mode. Generate scripts to manage iso build]"
"--standard[standard compression]"
"--theme=-[theme for livecd, calamares branding and partitions]:"
"--verbose[verbose]"
"--yolk[-y force yolk renew]"
  )
;;

status)
  _command_flags=(
    "--help[Show CLI help.]"
"--verbose[]"
  )
;;

syncfrom)
  _command_flags=(
    "--delete=-[rsync --delete delete extraneous files from dest dirs]:"
"--file=-[file LUKS volume encrypted]:"
"--help[Show CLI help.]"
"--rootdir=-[rootdir of the installed system, when used from live]:"
"--verbose[verbose]"
  )
;;

syncto)
  _command_flags=(
    "--delete=-[rsync --delete delete extraneous files from dest dirs]:"
"--file=-[file LUKS volume encrypted]:"
"--help[Show CLI help.]"
"--verbose[verbose]"
  )
;;

tools:clean)
  _command_flags=(
    "--help[Show CLI help.]"
"--nointeractive[no user interaction]"
"--verbose[verbose]"
  )
;;

tools:ppa)
  _command_flags=(
    "--add[add penguins-eggs PPA repository]"
"--help[Show CLI help.]"
"--nointeractive[no user interaction]"
"--remove[remove penguins-eggs PPA repository]"
"--verbose[verbose]"
  )
;;

tools:skel)
  _command_flags=(
    "--help[Show CLI help.]"
"--user=-[user to be used]:"
"--verbose[]"
  )
;;

tools:stat)
  _command_flags=(
    "--help[Show CLI help.]"
"--month[current month]"
"--year[current year]"
  )
;;

tools:yolk)
  _command_flags=(
    "--help[Show CLI help.]"
"--verbose[]"
  )
;;

update)
  _command_flags=(
    "--help[Show CLI help.]"
"--verbose[verbose]"
  )
;;

wardrobe:get)
  _command_flags=(
    "--help[Show CLI help.]"
"--verbose[]"
  )
;;

wardrobe:list)
  _command_flags=(
    "--help[Show CLI help.]"
"--distro=-[distro]:"
"--verbose[]"
  )
;;

wardrobe:show)
  _command_flags=(
    "--help[Show CLI help.]"
"--json[output JSON]"
"--verbose[]"
"--wardrobe=-[wardrobe]:"
  )
;;

wardrobe:wear)
  _command_flags=(
    "--help[Show CLI help.]"
"--no_accessories[not install accessories]"
"--no_firmwares[not install firmwares]"
"--verbose[]"
"--wardrobe=-[wardrobe]:"
  )
;;

autocomplete)
  _command_flags=(
    "--refresh-cache[Refresh cache (ignores displaying instructions)]"
  )
;;

help)
  _command_flags=(
    "--nested-commands[Include all nested commands in the output.]"
  )
;;

version)
  _command_flags=(
    "--json[Format output as json.]"
"--verbose[Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.]"
  )
;;

    esac
  }
  ## end public cli commands & flags

  _complete_commands () {
    _describe -t all-commands "all commands" _all_commands
  }

  if [ $CURRENT -gt 2 ]; then
    if [[ "$_cur" == -* ]]; then
      _set_flags
    else
      _path_files
    fi
  fi


  _arguments -S '1: :_complete_commands' \
                $_command_flags
}

_eggs
