Created
July 3, 2012 18:00
-
-
Save lwe/3041410 to your computer and use it in GitHub Desktop.
rbfu autocompletion for zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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