[Bash-completion-commits] [SCM] bash-completion branch, master, updated. c81b87fbd3e1c21eeae70f4f19bea85b948a8696
Ville Skyttä
ville.skytta at iki.fi
Sat Dec 4 19:08:12 UTC 2010
The following commit has been merged in the master branch:
commit c81b87fbd3e1c21eeae70f4f19bea85b948a8696
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sat Dec 4 21:05:54 2010 +0200
Make _command_offset() do the right thing with full path completions.
For example, "sudo /usr/sbin/useradd" completion didn't work properly,
whereas "sudo useradd" did.
diff --git a/bash_completion b/bash_completion
index d9e1b66..44137c2 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1495,8 +1495,8 @@ _command_offset()
COMPREPLY=( $( compgen -c -- "$cur" ) )
else
cmd=${COMP_WORDS[0]}
- if complete -p $cmd &>/dev/null; then
- cspec=$( complete -p $cmd )
+ if complete -p ${cmd##*/} &>/dev/null; then
+ cspec=$( complete -p ${cmd##*/} )
if [ "${cspec#* -F }" != "$cspec" ]; then
# complete -F <function>
@@ -1522,7 +1522,7 @@ _command_offset()
fi
elif [ -n "$cspec" ]; then
cspec=${cspec#complete};
- cspec=${cspec%%$cmd};
+ cspec=${cspec%%${cmd##*/}};
COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
fi
fi
--
bash-completion
More information about the Bash-completion-commits
mailing list