mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-26 23:00:30 +08: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:
commit
40a60d2847
@ -111,5 +111,11 @@ function chruby_prompt_info() {
|
||||
}
|
||||
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue
Block a user