Use _init_completion() in completions/g*.
This commit is contained in:
parent
06cf9c2a85
commit
10f6eb8ee2
@ -12,13 +12,13 @@ have gcc || return
|
||||
|
||||
_gcc()
|
||||
{
|
||||
local cur cc backend
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
_expand || return 0
|
||||
|
||||
local cc backend
|
||||
|
||||
case $1 in
|
||||
gcj)
|
||||
backend=jc1
|
||||
|
@ -5,10 +5,8 @@ have gcl || return
|
||||
|
||||
_gcl()
|
||||
{
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
# completing an option (may or may not be separated by a space)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
|
@ -4,12 +4,10 @@ have gdb || return
|
||||
|
||||
_gdb()
|
||||
{
|
||||
local cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
if [ $cword -eq 1 ]; then
|
||||
local IFS
|
||||
_compopt_o_filenames
|
||||
if [[ "$cur" == */* ]]; then
|
||||
@ -28,7 +26,7 @@ _gdb()
|
||||
-mindepth 1 -maxdepth 1 -not -type d -executable \
|
||||
-printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
|
||||
fi
|
||||
elif [ $COMP_CWORD -eq 2 ]; then
|
||||
elif [ $cword -eq 2 ]; then
|
||||
prev=${prev##*/}
|
||||
COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
|
||||
awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
|
||||
|
@ -4,10 +4,8 @@ have mkisofs || have genisoimage || return
|
||||
|
||||
_mkisofs()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
-o|-abstract|-biblio|-check-session|-copyright|-log-file| \
|
||||
|
@ -4,10 +4,8 @@ have getent || return
|
||||
|
||||
_getent()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
passwd)
|
||||
@ -39,7 +37,7 @@ _getent()
|
||||
esac
|
||||
|
||||
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
if [ $cword -eq 1 ]; then
|
||||
COMPREPLY=( $( compgen -W 'passwd group hosts services protocols \
|
||||
networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \
|
||||
shadow' -- "$cur" ) )
|
||||
|
@ -4,10 +4,8 @@ have gkrellm || have gkrellm2 || return
|
||||
|
||||
_gkrellm()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
-t|--theme)
|
||||
|
@ -4,10 +4,8 @@ have gnatmake || return
|
||||
|
||||
_gnatmake()
|
||||
{
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
# relevant (and less relevant ;-) )options completion
|
||||
|
@ -4,10 +4,8 @@ have gpg || return
|
||||
|
||||
_gpg()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
-s|--sign|--clearsign|--decrypt-files|--load-extension)
|
||||
|
@ -4,10 +4,8 @@ have gpg2 || return
|
||||
|
||||
_gpg2()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
--homedir)
|
||||
|
@ -4,10 +4,8 @@ have gzip || have pigz || return
|
||||
|
||||
_gzip()
|
||||
{
|
||||
local cur prev xspec
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case $prev in
|
||||
-b|--blocksize|-p|--processes|-S|--suffix|-h|--help|-V|--version)
|
||||
@ -16,15 +14,14 @@ _gzip()
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
local helpopts=`_parse_help ${COMP_WORDS[0]}`
|
||||
local helpopts=`_parse_help ${words[0]}`
|
||||
COMPREPLY=( $( compgen -W "$helpopts -1 -2 -3 -4 -5 -6 -7 -8 -9" \
|
||||
-- "$cur" ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
local IFS=$'\n'
|
||||
local IFS=$'\n' xspec="*.@(gz|t[ag]z)"
|
||||
|
||||
xspec="*.@(gz|t[ag]z)"
|
||||
if [[ "$prev" == --* ]]; then
|
||||
[[ "$prev" == --decompress || \
|
||||
"$prev" == --list || \
|
||||
@ -33,10 +30,6 @@ _gzip()
|
||||
elif [[ "$prev" == -* ]]; then
|
||||
[[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
|
||||
[[ "$prev" == -*f* ]] && xspec=
|
||||
elif [[ "$prev" == '>' || "$prev" == '>>' ]]; then
|
||||
xspec=
|
||||
elif [ "$prev" = '<' ]; then
|
||||
xspec=
|
||||
fi
|
||||
|
||||
_expand || return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user