summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLéon Keijser <keijser@stone-it.com>2010-07-30 23:39:26 +0200
committerJesse Keating <jkeating@redhat.com>2010-08-19 10:49:06 -0700
commit77137bf7b39eabb6981c782f3b3ea3512b2e21d0 (patch)
tree78cb4e0d61ca1fa9c36eb52455975784344f5856 /src
parentbeb4b618e51187d85aecc7c3cbfd4848f5770ad0 (diff)
downloadfedora-packager-77137bf7b39eabb6981c782f3b3ea3512b2e21d0.zip
fedora-packager-77137bf7b39eabb6981c782f3b3ea3512b2e21d0.tar.gz
fedora-packager-77137bf7b39eabb6981c782f3b3ea3512b2e21d0.tar.xz
Add bash-completion script for fedpkg
Diffstat (limited to 'src')
-rw-r--r--src/fedpkg.bash134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash
new file mode 100644
index 0000000..4cf8fc3
--- /dev/null
+++ b/src/fedpkg.bash
@@ -0,0 +1,134 @@
+# fedpkg bash completion
+
+have fedpkg &&
+_fedpkg()
+{
+ local cur prev commands options command
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur prev
+
+ commands='help build chain-build clean clog clone co commit compile diff \
+ gimmespec import install lint local mockbuild new new-sources patch prep \
+ push scratch-build sources srpm switch-branch tag-request unused-patches \
+ specfile update upload verrel'
+
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-h --help -u --user --path -v -q' \
+ -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
+ fi
+ else
+ case $prev in
+ --path|--file|-F|--outdir)
+ _filedir
+ return 0;
+ ;;
+ --arch|--arches)
+ COMPREPLY=( $( compgen -W 'i386 x86_64' -- "$cur" ) )
+ return 0;
+ ;;
+ --srpm)
+ COMPREPLY=( ${COMPREPLY[@]:-} \
+ $( compgen -W '$( command ls *.src.rpm 2>/dev/null )' \
+ -- "$cur" ) )
+ return 0;
+ ;;
+ -*)
+ return 0;
+ ;;
+ esac
+
+ command=${COMP_WORDS[1]}
+
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ build)
+ options='--nowait --background --skip-tag --scratch --test'
+ ;;
+ chain-build)
+ options='--nowait --background'
+ ;;
+ clean)
+ options='--dy-run -n -x'
+ ;;
+ clone|co)
+ options='--branches -B --branch -b --anonymous -a'
+ ;;
+ commit)
+ options='-m --message -F --file -p --push'
+ ;;
+ compile)
+ options='--arch --short-circuit'
+ ;;
+ import)
+ options='--branch -b --create -c'
+ ;;
+ install)
+ options='--arch --short-circuit'
+ ;;
+ local)
+ options='--arch --md5'
+ ;;
+ patch)
+ options='--suffix --rediff'
+ ;;
+ prep)
+ options='--arch'
+ ;;
+ scratch-build)
+ options='--nowait --background --arches --srpm'
+ ;;
+ sources)
+ options='--outdir'
+ ;;
+ srpm)
+ options='--md5'
+ ;;
+ switch-branch)
+ options='-l'
+ ;;
+ clog|gimmespec|lint|mockbuild|new|push|tag-request|\
+ unused-patches|update|verrel)
+ options='-h'
+ ;;
+ esac
+ options="$options --help -h"
+
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
+ else
+ case $command in
+ upload)
+ _filedir
+ ;;
+ import)
+ COMPREPLY=( ${COMPREPLY[@]:-} \
+ $( compgen -W '$( command ls *.src.rpm 2>/dev/null )' \
+ -- "$cur" ) )
+ ;;
+ # no further args required
+ help|build|clean|clog|compile|gimmespec|install|lint|local|\
+ mockbuild|new|patch|prep|push|scratch-build|sources|srpm|\
+ switch-branch|tag-request|unused-patches|update|verrel)
+ ;;
+ *)
+ _filedir
+ ;;
+ esac
+ fi
+ fi
+
+ return 0
+} &&
+complete -F _fedpkg -o filenames fedpkg
+
+# 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