trying to autocomp with spaces...

This commit is contained in:
Q
2022-10-17 22:18:15 +03:00
parent 0aa277a921
commit 40fed6563f

View File

@@ -441,23 +441,28 @@ _get_completer() {
local curr_arg local curr_arg
curr_arg=${COMP_WORDS[COMP_CWORD]} curr_arg=${COMP_WORDS[COMP_CWORD]}
if [[ $COMP_CWORD -eq 1 ]]; then if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=( $(compgen -W "help autocomplete l list c copy p paste delete Delete" -- $curr_arg ) ); COMPREPLY=( $(compgen -W "help autocomplete l list c copy p paste delete Delete" -- "$curr_arg" ) );
fi fi
if [[ $COMP_CWORD -eq 2 ]]; then if [[ $COMP_CWORD -eq 2 ]]; then
case ${COMP_WORDS[$(( $COMP_CWORD - 1 ))]} in case ${COMP_WORDS[1]} in
p|paste|d*|e|edit|rm|remove) d*|e|edit|rm|remove)
local IFS=$'"'"'\n'"'"' local IFS=$'"'"'\n'"'"'
local remotelist=( $( eval CCLIP_EXEC simplelist ) ) local remotelist=( $( eval CCLIP_EXEC simplelist ) )
COMPREPLY=( $(compgen -W "${remotelist[*]}" -- $curr_arg ) ); COMPREPLY=( $(compgen -W "${remotelist[*]}" -- "$curr_arg" ) );
;;
p|paste)
local IFS=$'"'"'\n'"'"'
local remotelist=( $( eval CCLIP_EXEC simplelist ) )
COMPREPLY=( $(compgen -W "${remotelist[*]}" -- "$curr_arg" ) );
;; ;;
c*) c*)
COMPREPLY=( $(compgen -f -d -X '' -- $curr_arg ) ); COMPREPLY=();
;; ;;
esac esac
fi fi
} }
complete -F _CCLIP_EXEC_complete CCLIP_EXEC complete -o bashdefault -o default -o nospace -F _CCLIP_EXEC_complete CCLIP_EXEC
# Run me as: source <( CCLIP_EXEC autocomplete ) # Run me as: source <( CCLIP_EXEC autocomplete )
' | sed "s,CCLIP_EXEC,$self,g" ' | sed "s,CCLIP_EXEC,$self,g"
exit 0 exit 0