Skip to content

Commit

Permalink
Add go item (#174)
Browse files Browse the repository at this point in the history
Co-authored-by: Dr. Stephan Heuer <dshr153@gmail.com>
  • Loading branch information
IlanCosman and dr-emacs committed Jul 14, 2021
1 parent 54bf900 commit 55f961b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Run pwd after all other items, which allows it to precisely react to prompt length ([#131][])
- Add `shlvl` item ([#156][] - @kidonng)
- Display pipenv virtual environments better in `virtual_env` item.
- Add `go` item ([#174][] - @dr-emacs)
- Performance improvements

### Bug fixes
Expand Down
3 changes: 3 additions & 0 deletions functions/_tide_item_go.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function _tide_item_go
test -e go.mod && _tide_print_item go $tide_go_icon' ' (go version | string match --regex "[\d.]+")
end
2 changes: 1 addition & 1 deletion functions/_tide_remove_unusable_items.fish
Original file line number Diff line number Diff line change
@@ -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 nvm php rustc virtual_env
for item in chruby git go nvm php rustc virtual_env
set -l cli_names $item
switch $item
case virtual_env
Expand Down
5 changes: 4 additions & 1 deletion functions/tide/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ tide_git_color_stash $_tide_color_green
tide_git_color_untracked $_tide_color_light_blue
tide_git_color_upstream $_tide_color_green
tide_git_icon
tide_go_bg_color 444444
tide_go_color 00AFAF
tide_go_icon 
tide_jobs_bg_color 444444
tide_jobs_color $_tide_color_dark_green
tide_jobs_icon ''
Expand Down Expand Up @@ -62,7 +65,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 vi_mode chruby
tide_right_prompt_items status cmd_duration context jobs nvm virtual_env rustc php chruby go vi_mode
tide_right_prompt_prefix ''
tide_right_prompt_separator_diff_color ''
tide_right_prompt_separator_same_color ''
Expand Down
2 changes: 2 additions & 0 deletions functions/tide/configure/configs/classic_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ tide_git_color_staged bryellow
tide_git_color_stash brgreen
tide_git_color_untracked brblue
tide_git_color_upstream brgreen
tide_go_bg_color black
tide_go_color cyan
tide_jobs_bg_color black
tide_jobs_color green
tide_nvm_bg_color black
Expand Down
5 changes: 4 additions & 1 deletion functions/tide/configure/configs/lean.fish
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ tide_git_color_stash $_tide_color_green
tide_git_color_untracked $_tide_color_light_blue
tide_git_color_upstream $_tide_color_green
tide_git_icon
tide_go_bg_color normal
tide_go_color 00AFAF
tide_go_icon 
tide_jobs_bg_color normal
tide_jobs_color $_tide_color_dark_green
tide_jobs_icon ''
Expand Down Expand Up @@ -62,7 +65,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
tide_right_prompt_items status cmd_duration context jobs nvm virtual_env rustc php chruby go
tide_right_prompt_prefix ' '
tide_right_prompt_separator_diff_color ' '
tide_right_prompt_separator_same_color ' '
Expand Down
2 changes: 2 additions & 0 deletions functions/tide/configure/configs/lean_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ tide_git_color_staged bryellow
tide_git_color_stash brgreen
tide_git_color_untracked brblue
tide_git_color_upstream brgreen
tide_go_bg_color normal
tide_go_color cyan
tide_jobs_bg_color normal
tide_jobs_color green
tide_nvm_bg_color normal
Expand Down
5 changes: 4 additions & 1 deletion functions/tide/configure/configs/rainbow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ tide_git_color_stash 000000
tide_git_color_untracked 000000
tide_git_color_upstream 000000
tide_git_icon
tide_go_bg_color FF8700
tide_go_color 2E3436
tide_go_icon 
tide_jobs_bg_color 444444
tide_jobs_color 4E9A06
tide_jobs_icon ''
Expand Down Expand Up @@ -62,7 +65,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 vi_mode chruby
tide_right_prompt_items status cmd_duration context jobs nvm virtual_env rustc php chruby go vi_mode
tide_right_prompt_prefix ''
tide_right_prompt_separator_diff_color ''
tide_right_prompt_separator_same_color ''
Expand Down
2 changes: 2 additions & 0 deletions functions/tide/configure/configs/rainbow_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ tide_git_color_staged black
tide_git_color_stash black
tide_git_color_untracked black
tide_git_color_upstream black
tide_go_bg_color yellow
tide_go_color black
tide_jobs_bg_color brblack
tide_jobs_color green
tide_nvm_bg_color magenta
Expand Down
19 changes: 19 additions & 0 deletions tests/_tide_item_go.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# RUN: %fish %s

function _go
_tide_decolor (_tide_item_go)
end

set -l goDir ~/goTest
mkdir -p $goDir
cd $goDir

mock go version "echo go version go1.16.5 linux/amd64"
set -lx tide_go_icon 

_go # CHECK:

touch go.mod
_go # CHECK:  1.16.5

rm -r $goDir

0 comments on commit 55f961b

Please sign in to comment.