[yum-commits] Makefile yum-utils.bash yum-utils.spec
Ville Skyttä
scop at osuosl.org
Tue Oct 20 16:37:52 UTC 2009
Makefile | 6 +++-
yum-utils.bash | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
yum-utils.spec | 1
3 files changed, 87 insertions(+), 1 deletion(-)
New commits:
commit 219953c903b5c797e2ea073d03c532fc8c34d266
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Oct 19 21:55:58 2009 +0300
Add bash completion for repomanage, package-cleanup and verifytree.
Should work with bash >= 3 and doesn't require any particular version
of bash-completion. Actually doesn't require bash-completion at all,
but without it one needs to source the file through other means
besides b-c's autoloading.
diff --git a/Makefile b/Makefile
index 63af6ac..248a9a3 100644
--- a/Makefile
+++ b/Makefile
@@ -10,10 +10,12 @@ WEBHOST = yum.baseurl.org
WEBPATH = /srv/projects/yum/web/download/yum-utils/
PY_FILES = $(wildcard *.py) $(wildcard plugins/*/*.py)
-
NMPROG=yum-NetworkManager-dispatcher
NMPATH=$(DESTDIR)/etc/NetworkManager/dispatcher.d
+BASHCOMP=yum-utils.bash
+BASHCOMPPATH=$(DESTDIR)/etc/bash_completion.d
+
clean:
rm -f *.pyc *.pyo *~
rm -f test/*~
@@ -33,6 +35,8 @@ install:
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
mkdir -p $(NMPATH)
install -m 755 $(NMPROG) $(NMPATH)
+ mkdir -p $(BASHCOMPPATH)
+ install -m 644 $(BASHCOMP) $(BASHCOMPPATH)
archive:
@rm -rf ${PKGNAME}-${VERSION}.tar.gz
diff --git a/yum-utils.bash b/yum-utils.bash
new file mode 100644
index 0000000..143299c
--- /dev/null
+++ b/yum-utils.bash
@@ -0,0 +1,81 @@
+# bash completion for yum-utils
+
+# repomanage
+_yu_repomanage()
+{
+ COMPREPLY=()
+
+ case "$3" in
+ -h|--help)
+ return 0
+ ;;
+ -k|--keep)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$2" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '--old --new --space --keep --nocheck
+ --help' -- "$2" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -d -- "$2" ) )
+} &&
+complete -F _yu_repomanage -o filenames repomanage
+
+# package-cleanup
+_yu_package_cleanup()
+{
+ COMPREPLY=()
+
+ case "$3" in
+ -h|--help|--leaf-regex|--qf|--queryformat)
+ return 0
+ ;;
+ --count)
+ COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) )
+ return 0
+ ;;
+ -c)
+ COMPREPLY=( $( compgen -f -o plusdirs -X "!*.conf" -- "$2" ) )
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W '--help --problems --leaves --all --leaf-regex
+ --exclude-devel --exclude-bin --orphans --noplugins --quiet -y --dupes
+ --cleandupes --oldkernels --count --keepdevel -c --queryformat' \
+ -- "$2" ) )
+} &&
+complete -F _yu_package_cleanup -o filenames package-cleanup
+
+# verifytree
+_yu_verifytree()
+{
+ COMPREPLY=()
+
+ case "$3" in
+ -h|--help|-t|--testopia)
+ return 0
+ ;;
+ esac
+
+ if [[ "$2" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '--help --checkall --testopia --treeinfo' \
+ -- "$2" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( compgen -d -- "$2" ) )
+} &&
+complete -F _yu_verifytree -o filenames verifytree
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/yum-utils.spec b/yum-utils.spec
index 35d06f7..4cc4161 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -419,6 +419,7 @@ fi
%doc README yum-util-cli-template
%doc COPYING
%doc plugins/README
+%{_sysconfdir}/bash_completion.d
%{_bindir}/debuginfo-install
%{_bindir}/find-repos-of-install
%{_bindir}/package-cleanup
More information about the Yum-commits
mailing list