Skip to content

Instantly share code, notes, and snippets.

@lwe
Created July 3, 2012 18:00
Show Gist options
  • Save lwe/3041410 to your computer and use it in GitHub Desktop.
Save lwe/3041410 to your computer and use it in GitHub Desktop.
rbfu autocompletion for zsh
#compdef rbfu
local curcontext="$curcontext" state line _rubies _rubies_dir ret=1
_arguments -w -S \
'(-)--help[show usage and exit]: :->noargs' \
'1: :->versions' \
'*::: :->args' && ret=0
case $state in
versions)
_rubies_dir="${RBFU_RUBIES}"
[[ ! -d "${_rubies_dir}" ]] && _rubies_dir="${HOME}/.rbfu/rubies"
_rubies=( $(ls -1 "${_rubies_dir}" 2>/dev/null | sed -e 's/^/@/') )
_rubies+=( $(echo "@system") )
_values 'rubies' $_rubies && ret=0
;;
args)
_normal && ret=0
;;
esac
return $ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment