# waylogout(1) completion

_waylogout()
{
  local cur prev
  _get_comp_words_by_ref -n : cur prev

  short=(
    -C
    -c
    -d
    -h
    -i
    -l
    -n
    -r
    -s
    -S
    -t
    -v
  )

  long=(
    --cancel-label
    --cancel-shortcut
    --cancel-symbol
    --custom-command
    --custom-label
    --custom-shortcut
    --custom-symbol
    --color
    --config
    --debug
    --effect-blur
    --effect-custom
    --effect-greyscale
    --effect-pixelate
    --effect-scale
    --effect-vignette
    --fade-in
    --font
    --help
    --hibernate-command
    --hibernate-label
    --hibernate-shortcut
    --hibernate-symbol
    --hide-cancel
    --image
    --indicator-radius
    --indicator-separation
    --indicator-thickness
    --indicator-x-position
    --indicator-y-position
    --inside-color
    --inside-selection-color
    --instant-run
    --label-font-size
    --labels
    --line-color
    --line-selection-color
    --line-uses-inside
    --line-uses-ring
    --lock-command
    --lock-label
    --lock-shortcut
    --lock-symbol
    --logout-command
    --logout-label
    --logout-symbol
    --logout-shortcut
    --poweroff-command
    --poweroff-label
    --poweroff-shortcut
    --poweroff-symbol
    --reboot-command
    --reboot-label
    --reboot-shortcut
    --reboot-symbol
    --reload-command
    --reload-label
    --reload-shortcut
    --reload-symbol
    --ring-color
    --ring-selection-color
    --rows
    --scaling
    --screenshots
    --scroll-sensitivity
    --selection-label
    --suspend-command
    --suspend-label
    --suspend-shortcut
    --suspend-symbol
    --switch-user-command
    --switch-user-label
    --switch-user-shortcut
    --switch-user-symbol
    --symbol-font-size
    --text-color
    --text-selection-color
    --tiling
    --time-effects
    --trace
    --version
  )

  scaling=(
    'stretch'
    'fill'
    'fit'
    'center'
    'tile'
    'solid_color'
  )

  case $prev in
    -c|--color)
      return
      ;;
    --scaling)
      COMPREPLY=($(compgen -W "${scaling[*]}" -- "$cur"))
      return
      ;;
    -i|--image)
      if grep -q : <<< "$cur"; then
        output="${cur%%:*}:"
        cur="${cur#*:}"
      else
        output=
      fi
      COMPREPLY=($(compgen -f -- "$cur"))
      return
      ;;
  esac

  if [[ $cur == --* ]]; then
    COMPREPLY=($(compgen -W "${long[*]}" -- "$cur"))
  else
    COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
    COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
  fi

} &&
complete -F _waylogout waylogout
