various fixes from Rafael Sepúlveda <drs@gnulinux.org.mx>
- fixed apt-cache 'show' completion bug - fixed function names with hyphens - aptitude completion function was loaded, regardless of presence of program - various improvements to other Debian commands
This commit is contained in:
parent
d1041d29dc
commit
046ad76d74
148
bash_completion
148
bash_completion
@ -1,6 +1,6 @@
|
|||||||
# bash_completion - some programmable completion functions for bash 2.05b
|
# bash_completion - some programmable completion functions for bash 2.05b
|
||||||
#
|
#
|
||||||
# $Id: bash_completion,v 1.436 2002/10/10 15:43:38 ianmacd Exp $
|
# $Id: bash_completion,v 1.437 2002/10/13 03:46:49 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -1446,10 +1446,6 @@ _apt_get()
|
|||||||
|
|
||||||
if [ -n "$special" ]; then
|
if [ -n "$special" ]; then
|
||||||
case $special in
|
case $special in
|
||||||
@(install|source|build-dep))
|
|
||||||
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
remove)
|
remove)
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
# Debian system
|
# Debian system
|
||||||
@ -1461,6 +1457,11 @@ _apt_get()
|
|||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1477,10 +1478,11 @@ _apt_get()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
esac
|
||||||
COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
|
|
||||||
dist-upgrade install remove source build-dep \
|
if [[ "$cur" == -* ]]; then
|
||||||
check clean autoclean -d -f -h -v -m -q -s -y \
|
|
||||||
|
COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \
|
||||||
-u -t -b -c -o --download-only --fix-broken \
|
-u -t -b -c -o --download-only --fix-broken \
|
||||||
--help --version --ignore-missing \
|
--help --version --ignore-missing \
|
||||||
--fix-missing --no-download --quiet --simulate \
|
--fix-missing --no-download --quiet --simulate \
|
||||||
@ -1492,8 +1494,14 @@ _apt_get()
|
|||||||
--list-cleanup --default-release \
|
--list-cleanup --default-release \
|
||||||
--trivial-only --no-remove --diff-only \
|
--trivial-only --no-remove --diff-only \
|
||||||
--tar-only --config-file --option' -- $cur ) )
|
--tar-only --config-file --option' -- $cur ) )
|
||||||
;;
|
else
|
||||||
esac
|
|
||||||
|
COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
|
||||||
|
dist-upgrade install remove source build-dep \
|
||||||
|
check clean autoclean' -- $cur ) )
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1511,23 +1519,28 @@ _apt_cache()
|
|||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
|
||||||
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
if [ "$cur" != show ]; then
|
||||||
if [[ ${COMP_WORDS[i]} == @(add|show?(pkg)|depends|dotty|policy) ]]; then
|
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
||||||
special=${COMP_WORDS[i]}
|
if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|policy|show?(pkg)) ]]; then
|
||||||
|
special=${COMP_WORDS[i]}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$special" ]; then
|
if [ -n "$special" ]; then
|
||||||
case $special in
|
case $special in
|
||||||
add)
|
add)
|
||||||
_filedir
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
show?(pkg)|depends|dotty|policy)
|
|
||||||
COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null) )
|
*)
|
||||||
return 0
|
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
|
||||||
;;
|
return 0
|
||||||
esac
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -1536,24 +1549,32 @@ _apt_cache()
|
|||||||
_filedir
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
search)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
*)
|
if [[ "$cur" == -* ]]; then
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W 'add gencaches showpkg stats dump \
|
COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
|
||||||
dumpavail unmet check search show dotty policy \
|
|
||||||
depends pkgnames -h -v -p -s -q -i -f -a -g -c \
|
|
||||||
-o --help --version --pkg-cache --src-cache \
|
-o --help --version --pkg-cache --src-cache \
|
||||||
--quiet --important --full --all-versions \
|
--quiet --important --full --all-versions \
|
||||||
--generate --no-generate --names-only \
|
--generate --no-generate --names-only \
|
||||||
--all-names --config-file --option \
|
--all-names --config-file --option \
|
||||||
--recurse' -- $cur ) )
|
--recurse' -- $cur ) )
|
||||||
;;
|
else
|
||||||
esac
|
|
||||||
|
COMPREPLY=( $( compgen -W 'add gencaches showpkg show stats \
|
||||||
|
dumpavail unmet check search dump dotty policy \
|
||||||
|
depends pkgnames' -- $cur ) )
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
[ "$have" ] && complete -F _apt-cache $filenames apt-cache
|
[ "$have" ] && complete -F _apt_cache $filenames apt-cache
|
||||||
complete -F _apt_cache $filenames apt-cache
|
|
||||||
|
|
||||||
# Debian aptitude(1) completion
|
# Debian aptitude(1) completion
|
||||||
#
|
#
|
||||||
@ -1624,8 +1645,11 @@ _aptitude()
|
|||||||
purge markauto unmarkauto dist-upgrade \
|
purge markauto unmarkauto dist-upgrade \
|
||||||
download search' -- $cur ) )
|
download search' -- $cur ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
complete -F _aptitude $default aptitude
|
[ "$have" ] && complete -F _aptitude $default aptitude
|
||||||
}
|
}
|
||||||
|
|
||||||
# Debian apt-build(1) completion.
|
# Debian apt-build(1) completion.
|
||||||
@ -1673,18 +1697,22 @@ _apt_build()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
esac
|
||||||
COMPREPLY=( $( compgen -W "update upgrade install remove \
|
|
||||||
source dist-upgrade world clean info \
|
if [[ "$cur" == -* ]]; then
|
||||||
clean-repository update-repository \
|
COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
|
||||||
--help --show-upgraded -u --build-dir \
|
|
||||||
--repository-dir --build-only \
|
--repository-dir --build-only \
|
||||||
--build-command --reinstall --rebuild \
|
--build-command --reinstall --rebuild \
|
||||||
--remove-builddep --no-wrapper --purge \
|
--remove-builddep --no-wrapper --purge \
|
||||||
--patch --patch-strip -p --yes -y \
|
--patch --patch-strip -p --yes -y \
|
||||||
--version -v --no-source" -- $cur ) )
|
--version -v --no-source' -- $cur ) )
|
||||||
;;
|
|
||||||
esac
|
else
|
||||||
|
COMPREPLY=( $( compgen -W 'update upgrade install remove \
|
||||||
|
source dist-upgrade world clean info \
|
||||||
|
clean-repository update-repository ' -- $cur ) )
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -2892,7 +2920,7 @@ complete -F _dpkg $filenames dpkg dpkg-deb
|
|||||||
# Debian GNU dpkg-reconfigure(8) completion
|
# Debian GNU dpkg-reconfigure(8) completion
|
||||||
#
|
#
|
||||||
have dpkg-reconfigure &&
|
have dpkg-reconfigure &&
|
||||||
_dpkg-reconfigure()
|
_dpkg_reconfigure()
|
||||||
{
|
{
|
||||||
local cur prev opt
|
local cur prev opt
|
||||||
|
|
||||||
@ -2923,7 +2951,7 @@ _dpkg-reconfigure()
|
|||||||
COMPREPLY=( $( _comp-dpkg-installed-packages $cur ) )
|
COMPREPLY=( $( _comp-dpkg-installed-packages $cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
[ "$have" ] && complete -F _dpkg-reconfigure $default dpkg-reconfigure
|
[ "$have" ] && complete -F _dpkg_reconfigure $default dpkg-reconfigure
|
||||||
|
|
||||||
# Debian Linux dselect(8) completion.
|
# Debian Linux dselect(8) completion.
|
||||||
#
|
#
|
||||||
@ -2945,13 +2973,17 @@ _dselect()
|
|||||||
_filedir
|
_filedir
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
|
||||||
COMPREPLY=( $( compgen -W 'access update select install \
|
|
||||||
config remove quit --admindir --help \
|
|
||||||
--version --licence --license --expert \
|
|
||||||
--debug' -- $cur ) )
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
COMPREPLY=( $( compgen -W -- $cur ) )
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
|
||||||
|
--license --expert --debug' -- $cur ) )
|
||||||
|
else
|
||||||
|
COMPREPLY=( $( compgen -W 'access update select install config \
|
||||||
|
remove quit' -- $cur ) )
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -3077,7 +3109,7 @@ _java()
|
|||||||
for ((i=1; i < $COMP_CWORD; i++)); do
|
for ((i=1; i < $COMP_CWORD; i++)); do
|
||||||
case ${COMP_WORDS[$i]} in
|
case ${COMP_WORDS[$i]} in
|
||||||
-cp|-classpath)
|
-cp|-classpath)
|
||||||
i++ # skip the classpath string.
|
i++ # skip the classpath string.
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
# this is an option, not a class/jarfile name.
|
# this is an option, not a class/jarfile name.
|
||||||
@ -3101,11 +3133,11 @@ _java()
|
|||||||
# relevant options completion
|
# relevant options completion
|
||||||
COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
|
COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
|
||||||
-cp -classpath -D -verbose -verbose:class \
|
-cp -classpath -D -verbose -verbose:class \
|
||||||
-verbose:gc -version:jni -version \
|
-verbose:gc -version:jni -version \
|
||||||
-showversion -? -help -X -jar \
|
-showversion -? -help -X -jar \
|
||||||
-ea -enableassertions -da -disableassertions \
|
-ea -enableassertions -da -disableassertions \
|
||||||
-esa -enablesystemassertions \
|
-esa -enablesystemassertions \
|
||||||
-dsa -disablesystemassertions ' -- $cur ) )
|
-dsa -disablesystemassertions ' -- $cur ) )
|
||||||
else
|
else
|
||||||
if [[ "$prev" == -jar ]]; then
|
if [[ "$prev" == -jar ]]; then
|
||||||
# jar file completion
|
# jar file completion
|
||||||
@ -3670,7 +3702,7 @@ _python()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
!(python|-?))
|
!(python|-?))
|
||||||
[[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W)) ]] && _filedir
|
[[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -3678,7 +3710,7 @@ _python()
|
|||||||
# if '-c' is already given, complete all kind of files.
|
# if '-c' is already given, complete all kind of files.
|
||||||
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
||||||
if [[ ${COMP_WORDS[i]} == -c ]]; then
|
if [[ ${COMP_WORDS[i]} == -c ]]; then
|
||||||
_filedir
|
_filedir
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -3686,8 +3718,8 @@ _python()
|
|||||||
if [[ "$cur" != -* ]]; then
|
if [[ "$cur" != -* ]]; then
|
||||||
_filedir '@(py|pyc|pyo)'
|
_filedir '@(py|pyc|pyo)'
|
||||||
else
|
else
|
||||||
COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
|
COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
|
||||||
-U -v -V -W -x -c" -- $cur ) )
|
-U -v -V -W -x -c" -- $cur ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user