Обновление ohmyzsh
This commit is contained in:
26
zsh/plugins/rbenv/README.md
Normal file
26
zsh/plugins/rbenv/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# rbenv plugin
|
||||
|
||||
The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
|
||||
version and gemset information into your prompt.
|
||||
|
||||
Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
|
||||
https://github.com/jf/rbenv-gemset
|
||||
|
||||
To use it, add `rbenv` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... rbenv)
|
||||
```
|
||||
|
||||
## Alias
|
||||
|
||||
| Alias | Command | Description |
|
||||
|----------------|---------------------|----------------------------------|
|
||||
| rubies | `rbenv versions` | List the installed Ruby versions |
|
||||
| gemsets | `rbenv gemset list` | List the existing gemsets |
|
||||
|
||||
## Functions
|
||||
|
||||
* `current_ruby`: The version of Ruby currently being used.
|
||||
* `current_gemset`: The name of the current gemset.
|
||||
* `gems`: Lists installed gems with enhanced formatting and color.
|
||||
* `rbenv_prompt_info`: For adding information to your prompt. Format: `<ruby version>@<current gemset>`.
|
||||
@@ -34,7 +34,7 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
|
||||
}
|
||||
|
||||
function current_gemset() {
|
||||
echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
|
||||
echo "$(rbenv gemset active 2>/dev/null)" | tr ' ' '+'
|
||||
}
|
||||
|
||||
function gems() {
|
||||
@@ -47,11 +47,10 @@ if [[ $FOUND_RBENV -eq 1 ]]; then
|
||||
}
|
||||
|
||||
function rbenv_prompt_info() {
|
||||
if [[ -n $(current_gemset) ]] ; then
|
||||
echo "$(current_ruby)@$(current_gemset)"
|
||||
else
|
||||
echo "$(current_ruby)"
|
||||
fi
|
||||
local ruby=$(current_ruby) gemset=$(current_gemset)
|
||||
echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
|
||||
[[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}"
|
||||
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||
}
|
||||
else
|
||||
alias rubies="ruby -v"
|
||||
@@ -59,7 +58,11 @@ else
|
||||
function current_ruby() { echo "not supported" }
|
||||
function current_gemset() { echo "not supported" }
|
||||
function gems() { echo "not supported" }
|
||||
function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
|
||||
function rbenv_prompt_info() {
|
||||
echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}"
|
||||
echo -n "system: $(ruby -v | cut -f-2 -d ' ')"
|
||||
echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
|
||||
}
|
||||
fi
|
||||
|
||||
unset FOUND_RBENV rbenvdirs dir
|
||||
|
||||
Reference in New Issue
Block a user