aboutsummaryrefslogtreecommitdiffstats
path: root/etc/youri-submit
diff options
context:
space:
mode:
Diffstat (limited to 'etc/youri-submit')
-rw-r--r--etc/youri-submit60
1 files changed, 60 insertions, 0 deletions
diff --git a/etc/youri-submit b/etc/youri-submit
new file mode 100644
index 0000000..6feb2c7
--- /dev/null
+++ b/etc/youri-submit
@@ -0,0 +1,60 @@
+# youri-submit completion
+# $Id$
+
+_youri-submit()
+{
+
+ local cur prev config
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case "$prev" in
+ --config)
+ _filedir
+ return 0
+ ;;
+ --list)
+ COMPREPLY=( $( compgen -W 'targets steps' -- $cur ) )
+ return 0
+ ;;
+ --help)
+ COMPREPLY=( $( compgen -W 'repository steps' -- $cur ) )
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--define --clean -l --list -h --help -t \
+ --test -v --verbose' -- $cur ) )
+ # add dangereous option for main command
+ if [[ ${COMP_WORDS[0]} == youri-submit ]]; then
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} --config --skip-step' \
+ -- $cur ) )
+ fi
+ else
+ _count_args
+ case $args in
+ 1)
+ _find_config
+ COMPREPLY=( $( compgen -W '$( youri-submit $config --list targets )' -- $cur ) )
+ ;;
+ *)
+ _filedir
+ ;;
+ esac
+ fi
+
+}
+complete -F _youri-submit youri-submit youri-submit-restricted youri-submit-proxy
+
+_find_config()
+{
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == --config ]]; then
+ config="--config ${COMP_WORDS[i+1]}"
+ break
+ fi
+ done
+}