[Mageia-dev] new mgarepo version
Angelo Naselli
anaselli at linux.it
Wed Jul 13 15:01:57 CEST 2011
> FWIW, I've been using the attached bash-completion file for some
> months now, however since I am not a bash-completion guru I didn't
> want to plague anyone else with any things I've messed up with it.
Great that means it works :)
I'm not a bash-completion guru as well, but i thought it was useful
for someone else, since we're two... that means we could be more :)
> @Angelo: Feel free to use anything from it, if any, to add to the file
> you have (note that I disabled the "auto completion of package names
> in SVN" since it's too slow for taste).
The attached one has it activated, i believe it is the same as yours but
for that change.
FWIW i find slower urpmi bash_complention, expecially if i want to
install a local package - i always forget ./XXX- you can figure out :)
HTH,
Angelo
-------------- next part --------------
# mgarepo(1) completion
#
_cauldron_packages()
{
COMPREPLY=( $( compgen -W '$(svn ls \
svn+ssh://svn.mageia.org/svn/packages/cauldron \
| sed -e "s|/$||" )' -- $cur ) )
}
_mgarepo_actions()
{
COMPREPLY=( $( compgen -W 'import create checkout co update info log \
tag submit extract sync commit ci build strip mass-update \
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
@(import|create))
options="--revision --distribution \
--branch --message --nocommit"
;;
@(checkout|co|info|log))
options="--revision --distribution \
--branch"
;;
update)
options="--revision --distribution \
--branch --release \
--spec-line-expression \
--keep-on-failure --message \
--target --nocommit --nosubmit"
;;
mass-update)
options="--include --exclude \
--keep-on-failure --nocommit \
--nosubmit"
;;
tag)
options="--revision"
;;
submit)
options="--revision --distribution \
--branch --target"
;;
extract)
options="--revision --distribution \
--branch --destdir --noprefix"
;;
@(commit|ci))
options="--sync --message"
;;
esac
options="$options --verbose -v --config -c --help"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
case $command in
help)
_mgarepo_actions
return 0
;;
import)
_filedir 'src.rpm'
return 0
;;
@(create|checkout|co|update|info|log|tag|submit|extract))
_cauldron_packages
return 0
;;
@(sync|commit|ci))
_filedir -d
return 0
;;
@(build|strip))
_filedir 'spec'
return 0
;;
esac
fi
fi
}
complete -F _mgarepo $filenames mgarepo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/mageia-dev/attachments/20110713/d949efa6/attachment.asc>
More information about the Mageia-dev
mailing list