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