1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 05:40:08 +00:00

chruby: add "system" to completion list if available (#5280)

Detect system Ruby in default `PATH`, and provide "system" completion if found.

Tested with [the Dockerfile](https://gist.github.com/franklinyu/b8deda6a5093a17b575679b5808b371f).
This commit is contained in:
Marc Cornellà 2018-10-01 16:50:17 +02:00 committed by GitHub
commit 40a60d2847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,5 +111,11 @@ function chruby_prompt_info() {
} }
# complete on installed rubies # complete on installed rubies
_chruby() { compadd $(chruby | tr -d '* ') } _chruby() {
compadd $(chruby | tr -d '* ')
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
if PATH=${default_path} type ruby &> /dev/null; then
compadd system
fi
}
compdef _chruby chruby compdef _chruby chruby