mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2025-06-13 13:03:54 +00:00
Add more options to conditionally show node version
This commit is contained in:
parent
332f23abd7
commit
7b195eb646
@ -124,7 +124,7 @@ set -g theme_newline_prompt '$ '
|
|||||||
**Prompt options**
|
**Prompt options**
|
||||||
|
|
||||||
- `theme_display_ruby`. Use `no` to completely hide all information about Ruby version. By default Ruby version displayed if there is the difference from default settings.
|
- `theme_display_ruby`. Use `no` to completely hide all information about Ruby version. By default Ruby version displayed if there is the difference from default settings.
|
||||||
- `theme_display_node`. If set to `yes`, will display current NVM or FNM node version.
|
- `theme_display_node`. If set to `yes`, will display current NVM or FNM node version. If set to `rc`, will display the version if an `.nvmrc` or `.node-version` file is found. If set to `package`, will display the version if a `package.json` file is found.
|
||||||
- `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported.
|
- `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported.
|
||||||
- `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator.
|
- `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator.
|
||||||
- `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`).
|
- `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`).
|
||||||
|
@ -895,9 +895,42 @@ function __bobthefish_prompt_desk -S -d 'Display current desk environment'
|
|||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function __bobthefish_prompt_find_file -S -d 'Find a file by going up the parent directories'
|
||||||
|
set -l dir "$argv[1]"
|
||||||
|
set -l file "$argv[2]"
|
||||||
|
|
||||||
|
if [ -z "$dir" ]
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
while [ "$dir" != '/' ]
|
||||||
|
if [ -f "$dir/$file" ]
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
set dir (dirname "$dir")
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
function __bobthefish_prompt_node -S -d 'Display current node version'
|
function __bobthefish_prompt_node -S -d 'Display current node version'
|
||||||
[ "$theme_display_node" = 'yes' -o "$theme_display_nvm" = 'yes' ]
|
set -l should_show
|
||||||
or return
|
|
||||||
|
if [ "$theme_display_node" = 'yes' -o "$theme_display_nvm" = 'yes' ]
|
||||||
|
set should_show 1
|
||||||
|
else if [ "$theme_display_node" = 'rc' ]
|
||||||
|
begin
|
||||||
|
__bobthefish_prompt_find_file "$PWD" .nvmrc
|
||||||
|
or __bobthefish_prompt_find_file "$PWD" .node-version
|
||||||
|
end
|
||||||
|
and set should_show 1
|
||||||
|
else if [ "$theme_display_node" = 'package' ]
|
||||||
|
__bobthefish_prompt_find_file "$PWD" package.json
|
||||||
|
and set should_show 1
|
||||||
|
end
|
||||||
|
|
||||||
|
[ -z "$should_show" ]
|
||||||
|
and return
|
||||||
|
|
||||||
set -l node_manager
|
set -l node_manager
|
||||||
set -l node_manager_dir
|
set -l node_manager_dir
|
||||||
|
Loading…
Reference in New Issue
Block a user