#!/bin/bash _store_completion() { CUR="${COMP_WORDS[COMP_CWORD]}" PRE="${COMP_WORDS[COMP_CWORD-1]}" local VALUES=() if [[ "${#COMP_WORDS[@]}" == "0" ]] || [[ "${COMP_WORDS[1]}" == "" ]] then VALUES=($(compgen -W "-s --search -v --view -i --install -r --remove --appimage --snap -u --update -h --help" -- ${CUR})) else case ${CUR} in -*) VALUES=($(compgen -W "-s --search -v --view -i --install -r --remove --appimage --snap -u --update -h --help" -- ${CUR})) ;; ''|*) [ -e $INFO_FILE ] || return case ${PRE} in '-v'|'--view' | '-i' | '--install' | '-r' | '--remove') VALUES=($(compgen -W "$(cat $INFO_FILE)" -- ${CUR})) ;; *) VALUES=() ;; esac ;; esac fi COMPREPLY=("${VALUES[@]}") } INFO_FILE=${HOME}/.cache/lliurex-store/data/bash_completion complete -F _store_completion lliurex-store-cli