summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--NEWS17
-rw-r--r--TODO46
-rw-r--r--gentoo92
4 files changed, 115 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index f819d1f..bfc5d6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2005-04-17 Aaron Walker <ka0ttic@gentoo.org>
+
+ * Tagged 20050417 Release.
+ * Fixed bug (#88797) that caused any package name matching "*-h*" to
+ be interpreted as -h|--help.
+ * Fixed bug (#88799) that caused -Ca (or any other option after -C) to
+ not complete properly on only installed packages.
+ * Fixed bug (#88152) that caused lack of filename completion after any
+ kind of redirect (> or <).
+ * Fixed bug in conditional completion if the condition wasn't quoted
+ and the package being completed also has an ebuild in one of the
+ overlays.
+
+2005-04-12 Aaron Walker <ka0ttic@gentoo.org>
+
+ * Added etcat completion.
+
+2005-04-09 Aaron Walker <ka0ttic@gentoo.org>
+
+ * Added have() so that it's possible for users to install the
+ completions "locally".
+
2005-03-29 Aaron Walker <ka0ttic@gentoo.org>
* Tagged 20050329 release.
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..eb3aa48
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,17 @@
+This file contains a summary of changes in released versions. Please read the
+ChangeLog for a more detailed listing of changes/bug fixes.
+
+20050417:
+ New features:
+ - etcat completion
+
+ Bug fixes:
+ - Fixed bug (#88797) that caused any package name matching "*-h*" to
+ be interpreted as -h|--help.
+ - Fixed bug (#88799) that caused -Ca (or any other option after -C) to
+ not complete properly on only installed packages.
+ - Fixed bug (#88152) that caused lack of filename completion after any
+ kind of redirect (> or <).
+ - Fixed bug in conditional completion if the condition wasn't quoted
+ and the package being completed also has an ebuild in one of the
+ overlays.
diff --git a/TODO b/TODO
index 8e097cb..e1903d9 100644
--- a/TODO
+++ b/TODO
@@ -7,52 +7,6 @@
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
-#
-# etcat completion command
-#
-have etcat && {
-_etcat()
-{
- # -b </path/to/file> [category]
- # belongs </path/to/file> [category]
- # Searches for the package which a file belongs to with an option
- # to restrict a search to a single or multiple category. Wildcards
- # in the category name is accepted to speed up searching.
- # (eg. etcat belongs /usr/lib/libmpeg.so "media-*")
- #
- # -c <package[-version]>
- # changes <package[-version]>
- # Outputs ChangeLog entry for the package and version specified.
- # Uses the latest package version if none specified.
- #
- # -d <regex expression>
- # depends <regex expression>
- # Searches through portage for a dependency string satisfying that
- # regular expression.
- #
- # -f <package[-version]>
- # files <package[-version]>
- # Lists all the files installed for this package.
- #
- # -s <package>
- # size <package>
- # Outputs the installed size of the package.
- #
- # -u <package[-version]>
- # uses <package[-version]>
- # Outputs the USE flags supported by this package and also their
- # installed state and description.
- #
- # -v <package>
- # versions <package>
- # Output all the versions for packages that match the package name
- # given with indication of whether the packages is stable, masked,
- # unstable or installed.
-
-}
-complete -F _etcat etcat
-}
-
# epm completion command
#
have epm && {
diff --git a/gentoo b/gentoo
index bbc8ced..32b9fd4 100644
--- a/gentoo
+++ b/gentoo
@@ -151,20 +151,26 @@ _pkgname()
have emerge && {
_emerge()
{
- local c cur curword numwords compwords opts cond prepend
+ local c cur prev curword numwords compwords opts cond prepend
local words stopre stophere i x
local action actionpos actionre sysactions eactions pkgpos
local version_mode searchdesc_mode help_mode resume_mode
local portdir=$(_portdir -o)
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
numwords=${#COMP_WORDS[*]}
curword=${COMP_CWORD}
compwords="${COMP_WORDS[*]}"
- actionre='@(-[CPcis]|@(metadata|s@(y@(nc|stem)|earch)|regen|@(unmerg|prune)e|world|@(@(dep)@(clean)|@(in@(fo|ject)))))'
- stopre=' @(depclean|info|metadata|regen|sy@(nc|stem)|world|--@(resume|s@(kipfirst|ync)))'
+ actionre='@(-?([A-Za-z]*)[CPcis]*|@(metadata|s@(y@(nc|stem)|earch)|regen|@(unmerg|prune)e|world|@(@(dep)@(clean)|@(in@(fo|ject)))))'
+ stopre=' @(?(--)depclean|?(--)info|?(--)metadata|regen|sy@(nc|stem)|world|--@(resume|s@(kipfirst|ync)))'
opts=''
+ if [[ ${prev} == '>' || ${prev} == '<' ]] ; then
+ COMPREPLY=($(compgen -f -- ${cur}))
+ return 0
+ fi
+
# find action
for x in ${compwords} ; do
if [[ ${x} == ${actionre} ]] ; then
@@ -181,13 +187,14 @@ _emerge()
break
fi
done
- if [[ ${#action} -eq 2 ]]; then
+
+ if [[ ${action} == -* && ${action} != --* ]] ; then
case "${action}" in
- '-C') action='unmerge' ;;
- '-P') action='prune' ;;
- '-c') action='clean' ;;
- '-i') action='inject' ;;
- '-s') action='search' ;;
+ -*C*) action='unmerge' ;;
+ -*P*) action='prune' ;;
+ -*c*) action='clean' ;;
+ -*i*) action='inject' ;;
+ -*s*) action='search' ;;
esac
fi
else
@@ -201,9 +208,9 @@ _emerge()
fi
# Check for special cases.
- [[ ${compwords} == *-@(V|-version)* ]] && version_mode=1
- [[ ${compwords} == *-@(S|-searchdesc)* ]] && searchdesc_mode=1
- [[ ${compwords} == *-@(h|-help)* ]] && help_mode=1
+ [[ ${compwords} == *" "-@(V|-version)* ]] && version_mode=1
+ [[ ${compwords} == *" "-@(S|-searchdesc)* ]] && searchdesc_mode=1
+ [[ ${compwords} == *" "-@(h|-help)* ]] && help_mode=1
# Handle special cases.
if [[ "${action}" == 'search' ]] || [[ -n "${searchdesc_mode}" ]] || \
@@ -245,7 +252,7 @@ _emerge()
--sync \
--tree \
--update --upgradeonly --usepkg --usepkgonly \
- --verbose"
+ --verbose --depclean --info --search"
if [[ ${curword} -eq 1 ]] && [[ ${numwords} -eq 2 ]] ; then
opts="${opts} --help --resume --searchdesc --version"
fi
@@ -324,7 +331,6 @@ _emerge()
else
c="${cond}"
fi
-
# Handle cases where a conditional is specified.
if [[ -n "${cond}" ]]; then
@@ -374,7 +380,12 @@ _emerge()
for x in ${cat}/${pkg}/*.ebuild ; do \
[[ -f "${x}" ]] || continue ; \
x="${x/${pkg}\/}" ; \
- echo "${c}${x%*.ebuild}" ; \
+ if [[ ${cond:0:1} == "'" ]] || \
+ [[ ${cond:0:1} == '"' ]] ; then
+ echo "${c}${x%*.ebuild}" ; \
+ else
+ echo "${x%*.ebuild}" ; \
+ fi ; \
done ; \
fi ; \
done))
@@ -529,7 +540,7 @@ _emerge()
return 0
}
-complete -F _emerge emerge
+complete -o filenames -F _emerge emerge
}
#
@@ -1430,4 +1441,53 @@ _webapp_config()
complete -F _webapp_config webapp-config
}
+#
+# etcat completion
+#
+
+have etcat && {
+_etcat()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts="-b belongs -c changes -d depends -f files -s size -u uses -v
+ versions"
+
+ if [[ ${COMP_CWORD} -eq 1 ]] ; then
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ return 0
+ fi
+
+ case "${prev}" in
+ -b|belongs)
+ COMPREPLY=($(compgen -f -- ${cur}))
+ ;;
+ -c|changes)
+ _pkgname -A ${cur}
+ ;;
+ -d|depends)
+ # kinda hard to complete on a regex...
+ COMPREPLY=()
+ ;;
+ -f|files|-s|size|-u|uses|-v|versions)
+ _pkgname -I ${cur}
+ ;;
+ *)
+ local x b=0
+ for x in ${COMP_WORDS[@]} ; do
+ [[ ${x} == "-b" || ${x} == "belongs" ]] && b=1
+ done
+
+ if [[ ${b} -eq 1 ]] ; then
+ local portdir=$(_portdir)
+ COMPREPLY=($(compgen -W "$(< ${portdir}/profiles/categories)" -- ${cur}))
+ fi
+ ;;
+ esac
+}
+complete -o filenames -F _etcat etcat
+}
+
# vim: set ft=sh tw=80 sw=4 et :