trying to autocomp with spaces...
This commit is contained in:
33
files/cclip
33
files/cclip
@@ -39,7 +39,7 @@ Get autocomplete:
|
||||
Config:
|
||||
CCLIP_HOME environment variable sets clipboard storage folder,
|
||||
defauls to ~/.cache/cclip
|
||||
"
|
||||
"
|
||||
exit
|
||||
}
|
||||
|
||||
@@ -364,10 +364,10 @@ _err() {
|
||||
}
|
||||
|
||||
_gui() {
|
||||
# GUI is intended for mc (midnight commander)
|
||||
# Example menu config
|
||||
# 5 cclip
|
||||
# cclip mc %s
|
||||
# GUI is intended for mc (midnight commander)
|
||||
# Example menu config
|
||||
# 5 cclip
|
||||
# cclip mc %s
|
||||
|
||||
CLIPBOARD=mc
|
||||
fileargs=$(( $# - 1 ))
|
||||
@@ -422,7 +422,7 @@ Options:
|
||||
d keep clipboard: %s
|
||||
e exit
|
||||
|
||||
Toggle option:\n" "$movelink" "$softlink" "$hardlink" "$keeplink"
|
||||
Toggle option:\n" "$movelink" "$softlink" "$hardlink" "$keeplink"
|
||||
read -s -n 1 optkey
|
||||
|
||||
case "$optkey" in
|
||||
@@ -430,7 +430,7 @@ Toggle option:\n" "$movelink" "$softlink" "$hardlink" "$keeplink"
|
||||
s) softlink=$(( 1 - softlink )) ;;
|
||||
l) hardlink=$(( 1 - hardlink )) ;;
|
||||
d) keeplink=$(( 1 - keeplink )) ;;
|
||||
e) break;;
|
||||
e) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -441,25 +441,30 @@ _get_completer() {
|
||||
local curr_arg
|
||||
curr_arg=${COMP_WORDS[COMP_CWORD]}
|
||||
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
|
||||
if [[ $COMP_CWORD -eq 2 ]]; then
|
||||
case ${COMP_WORDS[$(( $COMP_CWORD - 1 ))]} in
|
||||
p|paste|d*|e|edit|rm|remove)
|
||||
case ${COMP_WORDS[1]} in
|
||||
d*|e|edit|rm|remove)
|
||||
local IFS=$'"'"'\n'"'"'
|
||||
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*)
|
||||
COMPREPLY=( $(compgen -f -d -X '' -- $curr_arg ) );
|
||||
COMPREPLY=();
|
||||
;;
|
||||
esac
|
||||
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 )
|
||||
' | sed "s,CCLIP_EXEC,$self,g"
|
||||
' | sed "s,CCLIP_EXEC,$self,g"
|
||||
exit 0
|
||||
}
|
||||
_qCol() {
|
||||
|
||||
Reference in New Issue
Block a user