diff --git a/plugins/bb/_bb b/plugins/bb/_bb new file mode 100644 index 000000000..8540a5a24 --- /dev/null +++ b/plugins/bb/_bb @@ -0,0 +1,103 @@ +#compdef bb + +# Black Belt autocompletion for oh-my-zsh +# Requires: BlackBelt installed http://black-belt.readthedocs.org/en/latest/ +# Author: Ladislav Prskavec (ladislav@prskavec.net) + +# ----- Commands +# Seperate function for each command, makes extension easier later +# --------------------------- +__gh() { + local -a subcommands + subcommands=( + 'pr:Create PR' + 'deploy:Deploy PR' + 'merge:Merge PR' + ) + _describe -t commands 'bb gh' subcommands + _arguments \ + '--help[Show help message and exit.]' +} + +__hip() { + local -a subcommands + subcommands=( + 'last_errors' + 'post' + ) + _describe -t commands 'bb hip' subcommands + _arguments \ + '--help[Show help message and exit.]' +} + +__t() { + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':commands:->command' \ + '*::options:->options' + + case $state in + (command) + local -a subcommands + subcommands=( + 'curcard:Open current doing card in browser' + 'migrate-label:Usage:: bb t migrate-label --label="Product:...' + 'next:Takes the top card from To Do queue, moves it...' + 'next-week:Create new columns on the :term:`Work Board`:...' + 'schedule-list:Usage:: bb t schedule-list...' + 'verify:Looks through a checklists on :term:`Story`,...' + ) + _describe -t commands 'bb t' subcommands + _arguments \ + '--help[Show help message and exit.]' + ;; + (options) + case $line[1] in + (migrate-label) + _arguments \ + '---label[Label to migrate away]' \ + '--board[Board to migrate from]' \ + '--board-to[Board to migrate to]' \ + '--column[Column to migrate from]' \ + '--column-to[Column to migrate to]' + ;; + (schedule-list) + _arguments \ + '---label[Assign a label to the newly-created card. For now, label must be a color name.]' \ + '--owner[Whom to assign a created work card]' \ + '--story-list[Name of the list that should be converted to cards]' + ;; + esac + ;; + esac +} + +local -a _1st_arguments +_1st_arguments=( + "gh":"Handle github-related tasks and integrations." + "hip":"Handle HipChat-related tasks and..." + "init":"Initialize application for usage." + "stage":"Deploy current branch to staging" + "t":"Handle Trello-related actions and..." + "version":"Version" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "bb command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + gh) + __gh ;; + t) + __t ;; + hip) + __hip ;; +esac +