# mgarepo(1) completion # #_cooker_packages() #{ # COMPREPLY=( $( compgen -W '$(svn ls \ # svn+ssh://svn.mandriva.com/svn/packages/cooker \ # | sed -e "s|/$||" )' -- $cur ) ) #} _mgarepo_actions() { COMPREPLY=( $( compgen -W 'co ci authoremail changed create del \ getspec getsrpm import maintdb putsrpm rpmlog submit \ switch sync upload \ help' -- $cur ) ) } _mgarepo() { local cur prev command options i COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} if [[ $COMP_CWORD -eq 1 ]] ; then _mgarepo_actions else prev=${COMP_WORDS[COMP_CWORD-1]} case "$prev" in -@(c|-config)) _filedir return 0 ;; esac command=${COMP_WORDS[1]} if [[ "$cur" == -* ]]; then # possible options for the command case $command in submit) options="--define" ;; sync) options="--dry-run -c --download" ;; esac options="$options --help" COMPREPLY=( $( compgen -W "$options" -- $cur ) ) else case $command in help) _mgarepo_actions return 0 ;; import) _filedir 'src.rpm' return 0 ;; upload) _filedir 'tar.gz|tar.bz2|tar.lzma|tar.xz|zip' return 0 ;; del) _filedir 'tar.gz|tar.bz2|tar.lzma|tar.xz|zip' return 0 ;; @(sync|commit|ci)) _filedir -d return 0 ;; esac fi fi } complete -F _mgarepo $filenames mgarepo