# foo completion                                           -*- shell-script -*-

# This bash completions script was generated by
# completely (https://github.com/dannyben/completely)
# Modifying it manually is not recommended

_foo_completions_filter() {
  local words="$1"
  local cur=${COMP_WORDS[COMP_CWORD]}
  local result=()

  if [[ "${cur:0:1}" == "-" ]]; then
    echo "$words"
  
  else
    for word in $words; do
      [[ "${word:0:1}" != "-" ]] && result+=("$word")
    done

    echo "${result[*]}"

  fi
}

_foo_completions() {
  local cur=${COMP_WORDS[COMP_CWORD]}
  local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
  local compline="${compwords[*]}"

  case "$compline" in
    *'--config-file')
      while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
      ;;

    'config'*)
      while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_foo_completions_filter "help get set")" -- "$cur" )
      ;;

    'update'*)
      while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_foo_completions_filter "--quiet")" -- "$cur" )
      ;;

    *)
      while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_foo_completions_filter "--config-file help config list update ls up")" -- "$cur" )
      ;;

  esac
} &&
complete -F _foo_completions foo

# ex: filetype=sh
