29 lines
688 B
Bash
29 lines
688 B
Bash
_checkcert_completion() {
|
|
local IFS=$'\n'
|
|
local response
|
|
|
|
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _CHECKCERT_COMPLETE=bash_complete $1)
|
|
|
|
for completion in $response; do
|
|
IFS=',' read type value <<< "$completion"
|
|
|
|
if [[ $type == 'dir' ]]; then
|
|
COMREPLY=()
|
|
compopt -o dirnames
|
|
elif [[ $type == 'file' ]]; then
|
|
COMREPLY=()
|
|
compopt -o default
|
|
elif [[ $type == 'plain' ]]; then
|
|
COMPREPLY+=($value)
|
|
fi
|
|
done
|
|
|
|
return 0
|
|
}
|
|
|
|
_checkcert_completion_setup() {
|
|
complete -o nosort -F _checkcert_completion checkcert
|
|
}
|
|
|
|
_checkcert_completion_setup;
|
|
|