|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +_mistral() |
| 4 | +{ |
| 5 | + declare -A SUBCOMMANDS |
| 6 | + declare -A OPTS |
| 7 | + |
| 8 | + OPTS["action-create"]="-h --help -f --format -c --column --max-width --quote" |
| 9 | + OPTS["action-delete"]="-h --help" |
| 10 | + OPTS["action-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 11 | + OPTS["action-get-definition"]="-h --help" |
| 12 | + OPTS["action-list"]="-h --help -f --format -c --column --max-width --quote" |
| 13 | + OPTS["action-update"]="-h --help -f --format -c --column --max-width --quote" |
| 14 | + OPTS["complete"]="-h --help --name --shell" |
| 15 | + OPTS["cron-trigger-create"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 16 | + OPTS["cron-trigger-delete"]="-h --help" |
| 17 | + OPTS["cron-trigger-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 18 | + OPTS["cron-trigger-list"]="-h --help -f --format -c --column --max-width --quote" |
| 19 | + OPTS["environment-create"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 20 | + OPTS["environment-delete"]="-h --help" |
| 21 | + OPTS["environment-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 22 | + OPTS["environment-list"]="-h --help -f --format -c --column --max-width --quote" |
| 23 | + OPTS["environment-update"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 24 | + OPTS["execution-create"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 25 | + OPTS["execution-delete"]="-h --help" |
| 26 | + OPTS["execution-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 27 | + OPTS["execution-get-input"]="-h --help" |
| 28 | + OPTS["execution-get-output"]="-h --help" |
| 29 | + OPTS["execution-list"]="-h --help -f --format -c --column --max-width --quote" |
| 30 | + OPTS["execution-update"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 31 | + OPTS["help"]="-h --help" |
| 32 | + OPTS["task-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 33 | + OPTS["task-get-input"]="-h --help" |
| 34 | + OPTS["task-get-result"]="-h --help" |
| 35 | + OPTS["task-list"]="-h --help -f --format -c --column --max-width --quote" |
| 36 | + OPTS["task-update"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 37 | + OPTS["workbook-create"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 38 | + OPTS["workbook-delete"]="-h --help" |
| 39 | + OPTS["workbook-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 40 | + OPTS["workbook-get-definition"]="-h --help" |
| 41 | + OPTS["workbook-list"]="-h --help -f --format -c --column --max-width --quote" |
| 42 | + OPTS["workbook-update"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 43 | + OPTS["workflow-create"]="-h --help -f --format -c --column --max-width --quote" |
| 44 | + OPTS["workflow-delete"]="-h --help" |
| 45 | + OPTS["workflow-get"]="-h --help -f --format -c --column --max-width --variable --prefix" |
| 46 | + OPTS["workflow-get-definition"]="-h --help" |
| 47 | + OPTS["workflow-list"]="-h --help -f --format -c --column --max-width --quote" |
| 48 | + OPTS["workflow-update"]="-h --help -f --format -c --column --max-width --quote" |
| 49 | + |
| 50 | + COMMANDS="${!OPTS[*]}" |
| 51 | + COMPREPLY=() |
| 52 | + |
| 53 | + local cur="${COMP_WORDS[COMP_CWORD]}" |
| 54 | + local prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 55 | + |
| 56 | + if [[ $cur =~ (\.|\~|\/).* ]] ; then |
| 57 | + _filedir |
| 58 | + elif [ $COMP_CWORD == "1" ] ; then |
| 59 | + COMPREPLY=($(compgen -W "$COMMANDS" -- ${cur})) |
| 60 | + elif [ $COMP_CWORD == "2" ] ; then |
| 61 | + COMPREPLY=($(compgen -W "${OPTS[${prev}]}" -- ${cur})) |
| 62 | + fi |
| 63 | + return 0 |
| 64 | +} |
| 65 | +complete -F _mistral mistral |
0 commit comments