Add lftp option completion, simplify bookmark parsing, complete on hostnames.
This commit is contained in:
parent
1065f46e19
commit
a874b65b0e
2
CHANGES
2
CHANGES
@ -15,7 +15,7 @@ bash-completion (1.x)
|
|||||||
* Apply cardctl completion to pccardctl too.
|
* Apply cardctl completion to pccardctl too.
|
||||||
* Apply pine completion to alpine too.
|
* Apply pine completion to alpine too.
|
||||||
* Remove many unnecessary short option completions where long ones exist.
|
* Remove many unnecessary short option completions where long ones exist.
|
||||||
* Improve cvs, gkrellm, mdadm, and mysqladmin completions.
|
* Improve cvs, gkrellm, lftp, mdadm, and mysqladmin completions.
|
||||||
* Add wtf completion, based on work by Raphaël Droz.
|
* Add wtf completion, based on work by Raphaël Droz.
|
||||||
* Add lftpget completion.
|
* Add lftpget completion.
|
||||||
|
|
||||||
|
27
contrib/lftp
27
contrib/lftp
@ -3,20 +3,33 @@
|
|||||||
have lftp &&
|
have lftp &&
|
||||||
_lftp()
|
_lftp()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
|
case "$prev" in
|
||||||
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
|
-f)
|
||||||
~/.lftp/bookmarks )' -- "$cur" ) )
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-c|-h|--help|-v|--version|-e|-u|-p)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]] ; then
|
||||||
|
COMPREPLY=( $( compgen -W '-f -c --help --version -e -u -p' \
|
||||||
|
-- "$cur" ) )
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
COMPREPLY=( $( compgen -W \
|
||||||
|
'$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) )
|
||||||
|
_known_hosts_real "$cur"
|
||||||
} &&
|
} &&
|
||||||
complete -F _lftp $default lftp
|
complete -F _lftp $filenames lftp
|
||||||
|
|
||||||
have lftpget &&
|
have lftpget &&
|
||||||
_lftpget()
|
_lftpget()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user