aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Wang <joequant@mageia.org>2013-06-29 12:34:57 +0000
committerColin Guthrie <colin@mageia.org>2013-12-14 17:31:31 +0000
commita1b2214e865d42b13f83fa6a2c5163de4123ca56 (patch)
tree919f5aa3baea1a2360271549b653758d5cd310f2
parentc8890561326bf8013317de998a8afbb88ec511be (diff)
downloadmgarepo-a1b2214e865d42b13f83fa6a2c5163de4123ca56.tar
mgarepo-a1b2214e865d42b13f83fa6a2c5163de4123ca56.tar.gz
mgarepo-a1b2214e865d42b13f83fa6a2c5163de4123ca56.tar.bz2
mgarepo-a1b2214e865d42b13f83fa6a2c5163de4123ca56.tar.xz
mgarepo-a1b2214e865d42b13f83fa6a2c5163de4123ca56.zip
1.10.4 - add bash-completion1.10.4
-rw-r--r--CHANGES3
-rwxr-xr-xbash-completion/mgarepo98
-rwxr-xr-xmgarepo2
-rwxr-xr-xsetup.py2
4 files changed, 104 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 3eb0484..a2385b9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+* 1.10.4
+- Add completion/mgarepo with bash-completion
+
* 1.10.3
- in create-srpm, don't try to use youri db if not defined in config
- allow keeping the old rpm log in the package directory if the oldurl
diff --git a/bash-completion/mgarepo b/bash-completion/mgarepo
new file mode 100755
index 0000000..e27f12f
--- /dev/null
+++ b/bash-completion/mgarepo
@@ -0,0 +1,98 @@
+# mgarepo(1) completion
+#
+_cauldron_packages()
+{
+ COMPREPLY=( $( compgen -W "$(wget -O- \
+http://pkgsubmit.mageia.org/data/maintdb.txt 2>/dev/null | \
+cut -d ' ' -f 1)" -- $cur ) )
+}
+
+_mgarepo_actions()
+{
+ COMPREPLY=( $( compgen -W 'co ci sync \
+ submit putsrpm getspec rpmlog getsrpm maintdb create changed \
+ authoremail switch upload del up' -- $cur ) )
+}
+
+_mgarepo()
+{
+ local cur prev command options i
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W "--help" -- $cur ) )
+ else
+ _mgarepo_actions
+ fi
+ else
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ case "$prev" in
+ @(get|set))
+ _cauldron_packages
+ return 0
+ ;;
+ -@(F))
+ _filedir
+ return 0
+ ;;
+ esac
+
+ command=${COMP_WORDS[1]}
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ co)
+ options="-r --distribution \
+ --branch --spec --no-mirror"
+ ;;
+ ci)
+ options="-m -F"
+ ;;
+ sync)
+ options="-c --dry-run --download"
+ ;;
+ submit)
+ options="-t -l -r -s -i -a --distro --define"
+ ;;
+ putsrpm)
+ options="-l -t -b -d -c -s -n"
+ ;;
+ getsrpm)
+ options="-c -p -v -r -t -P -s -n -l -T -M --strict"
+ ;;
+ changed)
+ options="-a -s -M"
+ ;;
+ esac
+ options="$options --help"
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ case $command in
+ putsrpm)
+ _filedir 'src.rpm'
+ return 0
+ ;;
+ @(del|upload))
+ _filedir
+ return 0
+ ;;
+ @(co|getspec|rpmlog|getsrpm|changed))
+ _cauldron_packages
+ return 0
+ ;;
+ maintdb)
+ COMPREPLY=( $( compgen -W "get set" -- $cur ) )
+ return 0
+ ;;
+ @(sync|ci))
+ _filedir -d
+ return 0
+ ;;
+ esac
+ fi
+ fi
+}
+complete -F _mgarepo $filenames mgarepo
+complete -F _mgarepo $filenames mgarepo-ssh
diff --git a/mgarepo b/mgarepo
index 0353ad5..042c009 100755
--- a/mgarepo
+++ b/mgarepo
@@ -4,7 +4,7 @@ from MgaRepo.command import *
import getopt
import sys
-VERSION="1.10.3"
+VERSION="1.10.4"
HELP = """\
Usage: mgarepo COMMAND [COMMAND ARGUMENTS]
diff --git a/setup.py b/setup.py
index 8c7fb77..a712039 100755
--- a/setup.py
+++ b/setup.py
@@ -26,6 +26,8 @@ setup(name="mgarepo",
["default.chlog",
"revno.chlog",
"create-srpm"]),
+ ("share/bash-completion/completions",
+ ["bash-completion/mgarepo"]),
("/etc/", ["mgarepo.conf"]),
("share/man/man8/", ["mgarepo.8"])]
)