mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-12 15:50:01 -08:00
30 lines
690 B
Bash
30 lines
690 B
Bash
_fastanime_completion() {
|
|
local IFS=$'\n'
|
|
local response
|
|
|
|
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _FASTANIME_COMPLETE=bash_complete $1)
|
|
|
|
for completion in $response; do
|
|
IFS=',' read type value <<< "$completion"
|
|
|
|
if [[ $type == 'dir' ]]; then
|
|
COMPREPLY=()
|
|
compopt -o dirnames
|
|
elif [[ $type == 'file' ]]; then
|
|
COMPREPLY=()
|
|
compopt -o default
|
|
elif [[ $type == 'plain' ]]; then
|
|
COMPREPLY+=($value)
|
|
fi
|
|
done
|
|
|
|
return 0
|
|
}
|
|
|
|
_fastanime_completion_setup() {
|
|
complete -o nosort -F _fastanime_completion fastanime
|
|
}
|
|
|
|
_fastanime_completion_setup;
|
|
|