add node item (#181)

* add node

* Use string trim instead

Co-authored-by: Ilan Cosman <ilancosman@gmail.com>
This commit is contained in:
Branch Vincent 2021-08-11 17:45:12 -04:00 committed by GitHub
parent 79e8e40c84
commit 4f1002c3df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 4 deletions

View File

@ -0,0 +1,3 @@
function _tide_item_node
test -e package.json && _tide_print_item node $tide_node_icon' ' (node --version | string trim --chars=v)
end

View File

@ -1,6 +1,6 @@
function _tide_remove_unusable_items
# Remove tool-specific items for tools the machine doesn't have installed
for item in chruby git go kubectl nvm php rustc virtual_env
for item in chruby git go kubectl node nvm php rustc virtual_env
set -l cli_names $item
switch $item
case virtual_env

View File

@ -45,6 +45,9 @@ tide_left_prompt_prefix ''
tide_left_prompt_separator_diff_color ''
tide_left_prompt_separator_same_color ''
tide_left_prompt_suffix ''
tide_node_bg_color 444444
tide_node_color 44883E
tide_node_icon '⬢'
tide_nvm_bg_color 444444
tide_nvm_color 44883E
tide_nvm_icon '⬢'
@ -68,7 +71,7 @@ tide_pwd_icon_home
tide_pwd_icon_unwritable ''
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled true
tide_right_prompt_items status cmd_duration context jobs nvm virtual_env rustc php chruby go kubectl vi_mode
tide_right_prompt_items status cmd_duration context jobs node nvm virtual_env rustc php chruby go kubectl vi_mode
tide_right_prompt_prefix ''
tide_right_prompt_separator_diff_color ''
tide_right_prompt_separator_same_color ''

View File

@ -26,6 +26,8 @@ tide_jobs_bg_color black
tide_jobs_color green
tide_kubectl_bg_color black
tide_kubectl_color blue
tide_node_bg_color black
tide_node_color green
tide_nvm_bg_color black
tide_nvm_color green
tide_os_bg_color black

View File

@ -45,6 +45,9 @@ tide_left_prompt_prefix ''
tide_left_prompt_separator_diff_color ' '
tide_left_prompt_separator_same_color ' '
tide_left_prompt_suffix ' '
tide_node_bg_color normal
tide_node_color 44883E
tide_node_icon '⬢'
tide_nvm_bg_color normal
tide_nvm_color 44883E
tide_nvm_icon '⬢'
@ -68,7 +71,7 @@ tide_pwd_icon_home
tide_pwd_icon_unwritable ''
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled false
tide_right_prompt_items status cmd_duration context jobs nvm virtual_env rustc php chruby go kubectl
tide_right_prompt_items status cmd_duration context jobs node nvm virtual_env rustc php chruby go kubectl
tide_right_prompt_prefix ' '
tide_right_prompt_separator_diff_color ' '
tide_right_prompt_separator_same_color ' '

View File

@ -26,6 +26,8 @@ tide_jobs_bg_color normal
tide_jobs_color green
tide_kubectl_bg_color normal
tide_kubectl_color blue
tide_node_bg_color normal
tide_node_color green
tide_nvm_bg_color normal
tide_nvm_color green
tide_os_bg_color normal

View File

@ -45,6 +45,9 @@ tide_left_prompt_prefix ''
tide_left_prompt_separator_diff_color ''
tide_left_prompt_separator_same_color ''
tide_left_prompt_suffix ''
tide_node_bg_color 44883E
tide_node_color 000000
tide_node_icon '⬢'
tide_nvm_bg_color 44883E
tide_nvm_color 000000
tide_nvm_icon '⬢'
@ -68,7 +71,7 @@ tide_pwd_icon_home
tide_pwd_icon_unwritable ''
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled true
tide_right_prompt_items status cmd_duration context jobs nvm virtual_env rustc php chruby go kubectl vi_mode
tide_right_prompt_items status cmd_duration context jobs node nvm virtual_env rustc php chruby go kubectl vi_mode
tide_right_prompt_prefix ''
tide_right_prompt_separator_diff_color ''
tide_right_prompt_separator_same_color ''

View File

@ -26,6 +26,8 @@ tide_jobs_bg_color brblack
tide_jobs_color green
tide_kubectl_bg_color blue
tide_kubectl_color black
tide_node_bg_color green
tide_node_color black
tide_nvm_bg_color green
tide_nvm_color black
tide_os_bg_color white

View File

@ -0,0 +1,18 @@
# RUN: %fish %s
function _node
_tide_decolor (_tide_item_node)
end
set -l tmpdir (mktemp -d)
cd $tmpdir
mock node --version "echo v16.5.0"
set -lx tide_node_icon
_node # CHECK:
touch package.json
_node # CHECK: ⬢ 16.5.0
rm -r $tmpdir