Never type your workflow IDs again!

Note: This feature requires Bitrise CLI 1.10.1 or higher to work.

We don't have full shell completion for the Bitrise CLI (yet!) but for now, we can show you some clever snippets with which you can enable completion at least for the bitrise run command. You don't have to remember long workflow IDs anymore if you spend a lot of time in the terminal - after inserting these shell functions into the right place you'll be able to do the following:

Opens in a new window


    local cur prev opts
    if ! opts="$(bitrise workflows --id-only 2> /dev/null)"; then

    if [[ ${prev} == "run" && ${cur} == * ]] ; then
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
        return 0
complete -F _bitrise bitrise

You can insert this function into your .profile, .bash_profile or .bashrc file (depending on whichever you use) or you can place it along with other completion files in a directory (e.g. /usr/local/etc/bash_completion.d). To do the second, you can find some tips here.


#compdef bitrise

_bitrise() {
    local state
    local -a opts
    if ! opts=( $(bitrise workflows --id-only 2> /dev/null) ); then
        opts=( )

    _arguments \
        '1: :->subcommand' \
        '2: :->workflow_name'

    case ${state} in
        (subcommand) _arguments '1:wf:(run)' ;;
	    (workflow_name) compadd -Q "$@" ${opts}

_bitrise "$@"

Zsh loads completion functions from the directories present in the $fpath variable so paste the snippet into a file called _bitrise and place it into one of the directories listed in $fpath.

$ echo $fpath
/Users/gabortakacs/.oh-my-zsh/plugins/git /Users/gabortakacs/.oh-my-zsh/functions /Users/gabortakacs/.oh-my-zsh/completions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.3/functions
Note: There is a good chance /usr/local/share/zsh/site-functions and /usr/share/zsh/site-functions are added to the $fpath variable by default, so those two directories may be the best candidates.

If you use vanilla zsh and don't have any extension tools installed (e.g. oh-my-zsh or prezto, both will do the completion init for you) remember to call autoload -U compinit && compinit from your .zshrc.

Update (2017/12/11):

You might have to force rebuild the .zcompdump file:

$ rm -f ~/.zcompdump; compinit


complete -f -c bitrise -n '__fish_use_subcommand' -a run -d 'run specified workflow'
complete -f -c bitrise -n '__fish_seen_subcommand_from run' -a (bitrise workflows --id-only)

Fish might be the simplest one: just copy the above snippet into ~/.config/fish/completions/ and you're good to go!

Happy shelling! 🐚

Get Started for free

Start building now, choose a plan later.

Sign Up

Get started for free

Start building now, choose a plan later.