aboutsummaryrefslogtreecommitdiffstats
path: root/bash-completion
diff options
context:
space:
mode:
Diffstat (limited to 'bash-completion')
-rwxr-xr-xbash-completion/mgarepo177
1 files changed, 88 insertions, 89 deletions
diff --git a/bash-completion/mgarepo b/bash-completion/mgarepo
index 7440e64..d4026d4 100755
--- a/bash-completion/mgarepo
+++ b/bash-completion/mgarepo
@@ -2,104 +2,103 @@
#
_cauldron_packages()
{
- COMPREPLY=( $( compgen -W "$(wget -O- \
-http://pkgsubmit.mageia.org/data/maintdb.txt 2>/dev/null | \
-cut -d ' ' -f 1)" -- $cur ) )
+ 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 markrelease upload del up obsolete checkout \
- commit import' -- $cur ) )
+ COMPREPLY=( $( compgen -W 'co ci sync \
+ submit putsrpm getspec rpmlog getsrpm maintdb create changed \
+ authoremail switch markrelease upload del up obsolete checkout \
+ commit import' -- $cur ) )
}
-
+
_mgarepo()
{
- local cur prev command options i
+ 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 ) )
+ 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
- _mgarepo_actions
- fi
- else
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- @(get|set))
- _cauldron_packages
- return 0
- ;;
- -@(F))
- _filedir
- return 0
- ;;
- esac
+ 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|checkout)
- options="-r --distribution \
- --branch --spec --no-mirror"
- ;;
- ci|commit)
- options="-m -F"
- ;;
- sync)
- options="-c --dry-run --download"
- ;;
- submit)
- options="-t -l -r -s -i -a --distro --define"
- ;;
- putsrpm|import)
- 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"
- ;;
- markrelease)
- options="-f -r -v -n"
- ;;
- obsolete)
- options="-m"
- ;;
- esac
- options="$options --help"
- COMPREPLY=( $( compgen -W "$options" -- $cur ) )
- else
- case $command in
- putsrpm|import)
- _filedir 'src.rpm'
- return 0
- ;;
- @(del|upload))
- _filedir
- return 0
- ;;
- @(co|checkout|getspec|rpmlog|getsrpm|changed|obsolete))
- _cauldron_packages
- return 0
- ;;
- maintdb)
- COMPREPLY=( $( compgen -W "get set" -- $cur ) )
- return 0
- ;;
- @(sync|ci|commit))
- _filedir -d
- return 0
- ;;
- esac
- fi
- fi
+ command=${COMP_WORDS[1]}
+ if [[ "$cur" == -* ]]; then
+ # possible options for the command
+ case $command in
+ co|checkout)
+ options="-r --distribution --branch --spec --no-mirror"
+ ;;
+ ci|commit)
+ options="-m -F"
+ ;;
+ sync)
+ options="-c --dry-run --download"
+ ;;
+ submit)
+ options="-t -l -r -s -i -a --distro --define"
+ ;;
+ putsrpm|import)
+ 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"
+ ;;
+ markrelease)
+ options="-f -r -v -n"
+ ;;
+ obsolete)
+ options="-m"
+ ;;
+ esac
+ options="$options --help"
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ else
+ case $command in
+ putsrpm|import)
+ _filedir 'src.rpm'
+ return 0
+ ;;
+ @(del|upload))
+ _filedir
+ return 0
+ ;;
+ @(co|checkout|getspec|rpmlog|getsrpm|changed|obsolete))
+ _cauldron_packages
+ return 0
+ ;;
+ maintdb)
+ COMPREPLY=( $( compgen -W "get set" -- $cur ) )
+ return 0
+ ;;
+ @(sync|ci|commit))
+ _filedir -d
+ return 0
+ ;;
+ esac
+ fi
+ fi
}
complete -F _mgarepo $filenames mgarepo
complete -F _mgarepo $filenames mgarepo-ssh