2012-09-25 16:44:40 +04:00
# bash-completion add-on for rpmlint
# http://bash-completion.alioth.debian.org/
2012-10-25 15:26:22 +04:00
__abf_opts( )
2012-09-25 16:44:40 +04:00
{
if [ [ ${ cur } = = -* ] ] ; then
COMPREPLY = ( $( compgen -W " ${ @ } " -- " ${ cur } " ) )
return 0
fi
2013-05-17 12:11:20 +04:00
return 1
2012-09-25 16:44:40 +04:00
}
2012-10-25 15:26:22 +04:00
__abf_get( )
2012-09-25 16:44:40 +04:00
{
2013-05-17 12:11:20 +04:00
__abf_opts "--branch --verbose --help"
2012-09-25 16:44:40 +04:00
}
2014-11-06 16:06:35 +04:00
__abf_create( )
{
__abf_opts "--branch --no-def-branch --verbose --help"
}
2012-10-25 15:26:22 +04:00
__abf_put( )
2012-09-25 16:44:40 +04:00
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help --message --minimal-file-size --do-not-remove-files"
2012-09-25 16:44:40 +04:00
}
2012-10-25 15:26:22 +04:00
__abf_show( )
2012-09-25 16:44:40 +04:00
{
2013-05-17 12:11:20 +04:00
__abf_opts "--project --verbose --help"
2012-10-25 15:26:22 +04:00
shows = "build-repos build-platforms save-to-repos save-to-platforms"
if [ [ ${ cur } != -* ] ] ; then
if [ [ ${ prev } = = -* ] ] ; then
return 0;
fi
COMPREPLY = ( $( compgen -W " ${ shows } " -- " ${ cur } " ) )
return 0
fi
}
__abf_locate( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--project --directory --verbose --help"
2012-10-25 15:26:22 +04:00
actions = "update update-recursive"
if [ [ ${ cur } != -* ] ] ; then
if [ [ ${ prev } = = -* ] ] ; then
return 0;
fi
COMPREPLY = ( $( compgen -W " ${ actions } " -- " ${ cur } " ) )
return 0
fi
2012-09-25 16:44:40 +04:00
}
2012-12-13 14:58:28 +04:00
__abf_mock_urpm( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--config --verbose --help"
2012-12-13 14:58:28 +04:00
configs_dir = '/etc/abf/mock-urpm/configs'
if [ ${ prev } = = -c ] || [ ${ prev } = = --config ] ; then
COMPREPLY = ( $( compgen -W " ` ls -1 ${ configs_dir } /*.cfg | xargs -l basename | sed s/[.]cfg//g` " -- " ${ cur } " ) )
fi
}
__abf_rpmbuild( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help --build"
2012-12-13 14:58:28 +04:00
}
2012-10-25 15:26:22 +04:00
__abf_build( )
2012-09-25 16:44:40 +04:00
{
2015-03-31 21:20:31 +03:00
__abf_opts "--branch --build-list --tag --commit --target-platform --arch --repository --save-to-repository --auto-publish-status --auto-publish --update-type --skip-spec-check --auto-create-container --no-extra-tests --cached-chroot --save-chroot --testing --external-nodes"
2012-10-25 15:26:22 +04:00
update_types = "security bugfix enhancement recommended newpackage"
2015-03-31 21:20:31 +03:00
external_nodes_vals = "owned everything"
2014-03-06 23:08:02 +04:00
auto_publish_status = "none default testing"
2012-10-25 15:26:22 +04:00
if [ ${ prev } = = -r ] || [ ${ prev } = = --repository ] ; then
2012-11-22 17:18:41 +04:00
COMPREPLY = ( $( compgen -W "`abf show build-repos`" -- " ${ cur } " ) )
2012-10-25 15:26:22 +04:00
return 0
fi
if [ ${ prev } = = -s ] || [ ${ prev } = = --save-to-repository ] ; then
proj = ""
next = 0
for i in ${ COMP_WORDS [@] }
do
if [ [ $next = = 1 ] ] ; then
proj = $i ;
next = 0;
fi
if [ [ " $i " = = "-p" || " $i " = = "--project" ] ] ; then
next = 1;
fi ;
done
if [ -n " ${ proj } " ] ; then
2012-11-22 17:18:41 +04:00
COMPREPLY = ( $( compgen -W " `abf show save-to-repos -p ${ proj } ` " -- " ${ cur } " ) )
2012-10-25 15:26:22 +04:00
fi
return 0
fi
2014-11-06 16:06:35 +04:00
2012-10-25 15:26:22 +04:00
if [ ${ prev } = = --update-type ] ; then
COMPREPLY = ( $( compgen -W " ${ update_types } " -- " ${ cur } " ) )
return 0
fi
2015-03-31 21:20:31 +03:00
if [ ${ prev } = = --external-nodes ] ; then
COMPREPLY = ( $( compgen -W " ${ external_nodes_vals } " -- " ${ cur } " ) )
return 0
fi
2014-03-06 23:08:02 +04:00
if [ ${ prev } = = --auto-publish-status ] ; then
COMPREPLY = ( $( compgen -W " ${ auto_publish_status } " -- " ${ cur } " ) )
return 0
fi
2012-09-25 16:44:40 +04:00
}
2014-11-06 16:06:35 +04:00
__abf_chain_build( )
{
2014-11-06 16:39:03 +04:00
__abf_opts "--branch --build-list --tag --infile --commit --target-platform --arch --repository --save-to-repository --auto-publish-status --auto-publish --skip-spec-check --auto-create-container --no-extra-tests --cached-chroot --testing"
2014-11-06 16:06:35 +04:00
auto_publish_status = "none default testing"
if [ ${ prev } = = --auto-publish-status ] ; then
COMPREPLY = ( $( compgen -W " ${ auto_publish_status } " -- " ${ cur } " ) )
return 0
fi
}
2012-10-25 15:26:22 +04:00
__abf_publish( )
2012-09-25 16:44:40 +04:00
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help"
2012-09-25 16:44:40 +04:00
}
2012-12-13 14:58:28 +04:00
__abf_copy( )
2012-10-25 15:26:22 +04:00
{
2013-05-17 12:11:20 +04:00
__abf_opts "--pack --verbose --help"
2014-11-06 16:06:35 +04:00
2012-10-25 15:26:22 +04:00
if [ [ ${ cur } != -* ] ] ; then
branches = ` git branch --no-color | sed 's/^..//' | xargs echo `
COMPREPLY = ( $( compgen -W " ${ branches } " -- " ${ cur } " ) )
return 0
fi
}
2012-09-25 16:44:40 +04:00
2012-12-13 14:58:28 +04:00
__abf_status( )
2012-10-25 15:26:22 +04:00
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help"
2012-10-25 15:26:22 +04:00
}
__abf_help( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help"
2012-10-25 15:26:22 +04:00
}
2012-11-23 14:20:54 +04:00
__abf_search( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help"
2012-11-23 14:20:54 +04:00
types = "users groups platforms projects"
if [ " $COMP_CWORD " = = "2" ] ; then
COMPREPLY = ( $( compgen -W " ${ types } " -- " ${ cur } " ) )
return 0
fi
}
__abf_test( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--verbose --help"
2012-11-23 14:20:54 +04:00
}
__abf_fetch( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--only --verbose --help"
}
__abf_store( )
{
__abf_opts "--verbose --help"
if [ $? = = 0 ]
then
return 0;
fi
_filedir
return 0
2012-11-23 14:20:54 +04:00
}
2012-10-25 15:26:22 +04:00
2012-12-13 14:58:28 +04:00
__abf_clean( )
{
2013-05-17 12:11:20 +04:00
__abf_opts "--auto-remove --verbose --help"
}
__abf_alias( )
{
__abf_opts "--verbose --help"
types = "add remove list"
if [ " $COMP_CWORD " = = "2" ] ; then
COMPREPLY = ( $( compgen -W " ${ types } " -- " ${ cur } " ) )
return 0
fi
2014-11-06 16:06:35 +04:00
2012-12-13 14:58:28 +04:00
}
2012-10-25 15:26:22 +04:00
__abf( )
2012-09-25 16:44:40 +04:00
{
local opts modes
2015-02-17 13:04:34 +03:00
modes = "help get put show build chain_build publish status locate search test fetch mock-urpm rpmbuild clean copy create store alias add remove fork destroy pullrequest info"
2012-09-25 16:44:40 +04:00
COMPREPLY = ( )
mode = " ${ COMP_WORDS [1] } "
prev = " ${ COMP_WORDS [COMP_CWORD-1] } "
cur = " ${ COMP_WORDS [COMP_CWORD] } "
2014-11-06 16:06:35 +04:00
2012-10-25 15:26:22 +04:00
if [ " $COMP_CWORD " = = "1" ] || ( [ " $COMP_CWORD " = = "2" ] && [ " $mode " = = "help" ] ) ; then
2012-09-25 16:44:40 +04:00
COMPREPLY = ( $( compgen -W " ${ modes } " -- ${ cur } ) )
return 0
fi
2014-11-06 16:06:35 +04:00
2012-10-25 15:26:22 +04:00
for i in ${ modes }
do
if [ [ $i = = $mode ] ] ; then
2012-12-13 14:58:28 +04:00
j = ` echo ${ mode } | sed s/-/_/`
eval __abf_${ j } ;
2012-10-25 15:26:22 +04:00
fi
done
2014-11-06 16:06:35 +04:00
2012-09-25 16:44:40 +04:00
}
2012-10-25 15:26:22 +04:00
complete -F __abf abf
2012-09-25 16:44:40 +04:00