Try both full path and basename completions for sudo etc (Alioth: #313065).
This commit is contained in:
parent
770bcdf71d
commit
7c34b56267
1
CHANGES
1
CHANGES
@ -10,6 +10,7 @@ bash-completion (2.x)
|
|||||||
* Load and general speedups.
|
* Load and general speedups.
|
||||||
* Install only full path (no basename) completions for /etc/init.d/*.
|
* Install only full path (no basename) completions for /etc/init.d/*.
|
||||||
* Install full path /etc/rc.d/init.d/* completions.
|
* Install full path /etc/rc.d/init.d/* completions.
|
||||||
|
* Try both full path and basename completions for sudo etc (Alioth: #313065).
|
||||||
|
|
||||||
[ Guillaume Rousse ]
|
[ Guillaume Rousse ]
|
||||||
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)
|
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)
|
||||||
|
@ -1464,7 +1464,7 @@ _command()
|
|||||||
#
|
#
|
||||||
_command_offset()
|
_command_offset()
|
||||||
{
|
{
|
||||||
local cur func cline cspec noglob cmd i char_offset word_offset \
|
local cur func cline cspec noglob cmd compcmd i char_offset word_offset \
|
||||||
_COMMAND_FUNC _COMMAND_FUNC_ARGS
|
_COMMAND_FUNC _COMMAND_FUNC_ARGS
|
||||||
|
|
||||||
word_offset=$1
|
word_offset=$1
|
||||||
@ -1500,9 +1500,14 @@ _command_offset()
|
|||||||
_compopt_o_filenames
|
_compopt_o_filenames
|
||||||
COMPREPLY=( $( compgen -c -- "$cur" ) )
|
COMPREPLY=( $( compgen -c -- "$cur" ) )
|
||||||
else
|
else
|
||||||
cmd=${COMP_WORDS[0]}
|
cmd=${COMP_WORDS[0]} compcmd=${COMP_WORDS[0]}
|
||||||
if complete -p ${cmd##*/} &>/dev/null; then
|
# Do we have full path completion for $cmd?
|
||||||
cspec=$( complete -p ${cmd##*/} )
|
if ! cspec=$( complete -p $cmd 2>/dev/null ) && [[ $cmd == */* ]]; then
|
||||||
|
# Nope, what about the basename?
|
||||||
|
compcmd=${cmd##*/}
|
||||||
|
cspec=$( complete -p $compcmd 2>/dev/null )
|
||||||
|
fi
|
||||||
|
if [[ -n $cspec ]]; then
|
||||||
if [ "${cspec#* -F }" != "$cspec" ]; then
|
if [ "${cspec#* -F }" != "$cspec" ]; then
|
||||||
# complete -F <function>
|
# complete -F <function>
|
||||||
|
|
||||||
@ -1528,9 +1533,9 @@ _command_offset()
|
|||||||
_compopt_o_filenames
|
_compopt_o_filenames
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ -n "$cspec" ]; then
|
else
|
||||||
cspec=${cspec#complete};
|
cspec=${cspec#complete};
|
||||||
cspec=${cspec%%${cmd##*/}};
|
cspec=${cspec%%$compcmd};
|
||||||
COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
|
COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
|
||||||
fi
|
fi
|
||||||
elif [ ${#COMPREPLY[@]} -eq 0 ]; then
|
elif [ ${#COMPREPLY[@]} -eq 0 ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user