Use _init_completion() in completions/d*.
This commit is contained in:
parent
2738468dde
commit
4bc5f90b3e
@ -4,10 +4,8 @@ have dd || return
|
|||||||
|
|
||||||
_dd()
|
_dd()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev words cword
|
||||||
|
_init_completion -n = || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref -n = cur
|
|
||||||
|
|
||||||
case $cur in
|
case $cur in
|
||||||
if=*|of=*)
|
if=*|of=*)
|
||||||
|
@ -4,10 +4,8 @@ have dhclient || return
|
|||||||
|
|
||||||
_dhclient()
|
_dhclient()
|
||||||
{
|
{
|
||||||
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
|
||||||
-cf|-lf|-pf|-sf)
|
-cf|-lf|-pf|-sf)
|
||||||
|
@ -10,26 +10,25 @@ _dictdata()
|
|||||||
|
|
||||||
_dict()
|
_dict()
|
||||||
{
|
{
|
||||||
local cur prev host port db dictfile
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local host port db i
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
dictfile=/usr/share/dict/words
|
|
||||||
|
|
||||||
for (( i=1; i < COMP_CWORD; i++ )); do
|
for (( i=1; i < cword; i++ )); do
|
||||||
case ${COMP_WORDS[i]} in
|
case ${words[i]} in
|
||||||
-h|--host)
|
-h|--host)
|
||||||
host=${COMP_WORDS[i+1]}
|
host=${words[i+1]}
|
||||||
[ -n "$host" ] && host="-h $host"
|
[ -n "$host" ] && host="-h $host"
|
||||||
i=$((++i))
|
i=$((++i))
|
||||||
;;
|
;;
|
||||||
-p|--port)
|
-p|--port)
|
||||||
port=${COMP_WORDS[i+1]}
|
port=${words[i+1]}
|
||||||
[ -n "$port" ] && port="-p $port"
|
[ -n "$port" ] && port="-p $port"
|
||||||
i=$((++i))
|
i=$((++i))
|
||||||
;;
|
;;
|
||||||
-d|--database)
|
-d|--database)
|
||||||
db=${COMP_WORDS[i+1]}
|
db=${words[i+1]}
|
||||||
[ -n "$db" ] && host="-d $db"
|
[ -n "$db" ] && host="-d $db"
|
||||||
i=$((++i))
|
i=$((++i))
|
||||||
;;
|
;;
|
||||||
@ -63,6 +62,7 @@ _dict()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
local dictfile=/usr/share/dict/words
|
||||||
[ -r $dictfile ] && \
|
[ -r $dictfile ] && \
|
||||||
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
|
||||||
} &&
|
} &&
|
||||||
|
@ -20,21 +20,20 @@ _comp_dpkg_installed_packages()
|
|||||||
#
|
#
|
||||||
_dpkg()
|
_dpkg()
|
||||||
{
|
{
|
||||||
local cur prev i
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
i=$COMP_CWORD
|
|
||||||
|
|
||||||
_expand || return 0
|
_expand || return 0
|
||||||
|
|
||||||
_split_longopt
|
_split_longopt
|
||||||
|
|
||||||
|
local i=$cword
|
||||||
|
|
||||||
# find the last option flag
|
# find the last option flag
|
||||||
if [[ $cur != -* ]]; then
|
if [[ $cur != -* ]]; then
|
||||||
while [[ $prev != -* && $i -ne 1 ]]; do
|
while [[ $prev != -* && $i -ne 1 ]]; do
|
||||||
i=$((i-1))
|
i=$((i-1))
|
||||||
prev=${COMP_WORDS[i-1]}
|
prev=${words[i-1]}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -100,10 +99,10 @@ complete -F _dpkg dpkg dpkg-deb
|
|||||||
have dpkg-reconfigure &&
|
have dpkg-reconfigure &&
|
||||||
_dpkg_reconfigure()
|
_dpkg_reconfigure()
|
||||||
{
|
{
|
||||||
local cur prev opt
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local opt
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-f|--frontend)
|
-f|--frontend)
|
||||||
@ -133,7 +132,10 @@ complete -F _dpkg_reconfigure -o default dpkg-reconfigure
|
|||||||
have dpkg-source &&
|
have dpkg-source &&
|
||||||
_dpkg_source()
|
_dpkg_source()
|
||||||
{
|
{
|
||||||
local cur prev options work i action packopts unpackopts fields
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
|
local options work i action packopts unpackopts fields
|
||||||
|
|
||||||
packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \
|
packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sr -ss -sA -sK -sP \
|
||||||
-sU -sR"
|
-sU -sR"
|
||||||
@ -142,16 +144,13 @@ _dpkg_source()
|
|||||||
fields="Format Source Version Binary Maintainer Uploader Architecture \
|
fields="Format Source Version Binary Maintainer Uploader Architecture \
|
||||||
Standards-Version Build-Depends Files"
|
Standards-Version Build-Depends Files"
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
action="options"
|
action="options"
|
||||||
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
|
for (( i=0; i < ${#words[@]}-1; i++ )); do
|
||||||
if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
|
if [[ ${words[$i]} == "-x" ]]; then
|
||||||
action=unpack
|
action=unpack
|
||||||
elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
|
elif [[ ${words[$i]} == "-b" ]]; then
|
||||||
action=pack
|
action=pack
|
||||||
elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
|
elif [[ ${words[$i]} == "-h" ]]; then
|
||||||
action=help
|
action=help
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -4,10 +4,8 @@ have dselect || return
|
|||||||
|
|
||||||
_dselect()
|
_dselect()
|
||||||
{
|
{
|
||||||
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
|
||||||
--admindir)
|
--admindir)
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
have arpspoof &&
|
have arpspoof &&
|
||||||
_arpspoof()
|
_arpspoof()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -31,10 +29,8 @@ complete -F _arpspoof arpspoof
|
|||||||
have dnsspoof &&
|
have dnsspoof &&
|
||||||
_dnsspoof()
|
_dnsspoof()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -57,10 +53,8 @@ complete -F _dnsspoof dnsspoof
|
|||||||
have dsniff &&
|
have dsniff &&
|
||||||
_dsniff()
|
_dsniff()
|
||||||
{
|
{
|
||||||
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
|
||||||
-r|-w|-f)
|
-r|-w|-f)
|
||||||
@ -83,10 +77,8 @@ complete -F _dsniff dsniff
|
|||||||
have filesnarf || have mailsnarf || have msgsnarf &&
|
have filesnarf || have mailsnarf || have msgsnarf &&
|
||||||
_snarf()
|
_snarf()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -105,10 +97,8 @@ complete -F _snarf filesnarf mailsnarf msgsnarf
|
|||||||
have macof &&
|
have macof &&
|
||||||
_macof()
|
_macof()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -128,10 +118,8 @@ complete -F _macof macof
|
|||||||
have sshmitm &&
|
have sshmitm &&
|
||||||
_sshmitm()
|
_sshmitm()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
|
||||||
@ -145,10 +133,8 @@ complete -F _sshmitm sshmitm
|
|||||||
have sshow &&
|
have sshow &&
|
||||||
_sshow()
|
_sshow()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -167,10 +153,8 @@ complete -F _sshow sshow
|
|||||||
have tcpkill &&
|
have tcpkill &&
|
||||||
_tcpkill()
|
_tcpkill()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -189,10 +173,8 @@ complete -F _tcpkill tcpkill
|
|||||||
have tcpnice &&
|
have tcpnice &&
|
||||||
_tcpnice()
|
_tcpnice()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -211,10 +193,8 @@ complete -F _tcpnice tcpnice
|
|||||||
have urlsnarf &&
|
have urlsnarf &&
|
||||||
_urlsnarf()
|
_urlsnarf()
|
||||||
{
|
{
|
||||||
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
|
||||||
-i)
|
-i)
|
||||||
@ -233,10 +213,8 @@ complete -F _urlsnarf urlsnarf
|
|||||||
have webmitm &&
|
have webmitm &&
|
||||||
_webmitm()
|
_webmitm()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )
|
||||||
|
@ -4,9 +4,8 @@ have growisofs || return
|
|||||||
|
|
||||||
_growisofs()
|
_growisofs()
|
||||||
{
|
{
|
||||||
COMPREPLY=()
|
local cur prev words cword
|
||||||
local cur prev
|
_init_completion || return
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-version|-speed)
|
-version|-speed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user