summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Walker <ka0ttic@gentoo.org>2005-04-12 12:28:58 +0000
committerAaron Walker <ka0ttic@gentoo.org>2005-04-12 12:28:58 +0000
commitb048755fb1f93be51026a273acec6ac94fbf8383 (patch)
tree721604e58f3020b9cda432dc7849eb8b4531b144
parentAdd have() for local installations; bug 88326. (diff)
downloadgentoo-bashcomp-b048755fb1f93be51026a273acec6ac94fbf8383.tar.gz
gentoo-bashcomp-b048755fb1f93be51026a273acec6ac94fbf8383.tar.bz2
gentoo-bashcomp-b048755fb1f93be51026a273acec6ac94fbf8383.zip
Added etcat completion.
svn path=/trunk/; revision=38
-rw-r--r--ChangeLog9
-rw-r--r--NEWS1
-rw-r--r--TODO46
-rw-r--r--gentoo49
4 files changed, 59 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index f819d1f..a062333 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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..6974e6a
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+Empty 'til release.
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..a7068b8 100644
--- a/gentoo
+++ b/gentoo
@@ -1430,4 +1430,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 :