Skip to content

Commit

Permalink
add direnv (#398)
Browse files Browse the repository at this point in the history
* add direnv

* fixes
  • Loading branch information
branchvincent authored Apr 5, 2023
1 parent 6a9d3e2 commit 270b269
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 4 deletions.
7 changes: 7 additions & 0 deletions functions/_tide_item_direnv.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function _tide_item_direnv
set -q DIRENV_DIR || return
direnv status | string match -q 'Found RC allowed false' \
&& set -lx tide_direnv_color $tide_direnv_color_denied \
&& set -lx tide_direnv_bg_color $tide_direnv_bg_color_denied
_tide_print_item direnv $tide_direnv_icon
end
2 changes: 1 addition & 1 deletion functions/_tide_remove_unusable_items.fish
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function _tide_remove_unusable_items
# Remove tool-specific items for tools the machine doesn't have installed
set -l removed_items
for item in aws chruby crystal distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi rustc terraform toolbox virtual_env
for item in aws chruby crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi rustc terraform toolbox virtual_env
set -l cli_names $item
switch $item
case distrobox # there is no 'distrobox' command inside the container
Expand Down
7 changes: 6 additions & 1 deletion functions/tide/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ tide_context_hostname_parts 1
tide_crystal_bg_color 444444
tide_crystal_color FFFFFF
tide_crystal_icon ⬢
tide_direnv_bg_color 444444
tide_direnv_bg_color_denied 444444
tide_direnv_color $_tide_color_gold
tide_direnv_color_denied FF0000
tide_direnv_icon ▼
tide_distrobox_bg_color 444444
tide_distrobox_color FF00FF
tide_distrobox_icon ⬢
Expand Down Expand Up @@ -102,7 +107,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 node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_prefix 
tide_right_prompt_separator_diff_color 
tide_right_prompt_separator_same_color 
Expand Down
4 changes: 4 additions & 0 deletions functions/tide/configure/configs/classic_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ tide_context_color_root bryellow
tide_context_color_ssh yellow
tide_crystal_bg_color black
tide_crystal_color brwhite
tide_direnv_bg_color black
tide_direnv_bg_color_denied black
tide_direnv_color bryellow
tide_direnv_color_denied brred
tide_distrobox_bg_color black
tide_distrobox_color brmagenta
tide_docker_bg_color black
Expand Down
7 changes: 6 additions & 1 deletion functions/tide/configure/configs/lean.fish
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ tide_context_hostname_parts 1
tide_crystal_bg_color normal
tide_crystal_color FFFFFF
tide_crystal_icon ⬢
tide_direnv_bg_color normal
tide_direnv_bg_color_denied normal
tide_direnv_color $_tide_color_gold
tide_direnv_color_denied FF0000
tide_direnv_icon ▼
tide_distrobox_bg_color normal
tide_distrobox_color FF00FF
tide_distrobox_icon ⬢
Expand Down Expand Up @@ -102,7 +107,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 node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_prefix ' '
tide_right_prompt_separator_diff_color ' '
tide_right_prompt_separator_same_color ' '
Expand Down
4 changes: 4 additions & 0 deletions functions/tide/configure/configs/lean_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ tide_context_color_root bryellow
tide_context_color_ssh yellow
tide_crystal_bg_color normal
tide_crystal_color brwhite
tide_direnv_bg_color normal
tide_direnv_bg_color_denied normal
tide_direnv_color bryellow
tide_direnv_color_denied brred
tide_distrobox_bg_color normal
tide_distrobox_color brmagenta
tide_docker_bg_color normal
Expand Down
7 changes: 6 additions & 1 deletion functions/tide/configure/configs/rainbow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ tide_context_hostname_parts 1
tide_crystal_bg_color FFFFFF
tide_crystal_color 000000
tide_crystal_icon ⬢
tide_direnv_bg_color $_tide_color_gold
tide_direnv_bg_color_denied FF0000
tide_direnv_color 000000
tide_direnv_color_denied 000000
tide_direnv_icon ▼
tide_distrobox_bg_color FF00FF
tide_distrobox_color 000000
tide_distrobox_icon ⬢
Expand Down Expand Up @@ -102,7 +107,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 node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_prefix 
tide_right_prompt_separator_diff_color 
tide_right_prompt_separator_same_color 
Expand Down
4 changes: 4 additions & 0 deletions functions/tide/configure/configs/rainbow_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ tide_context_color_root yellow
tide_context_color_ssh yellow
tide_crystal_bg_color brwhite
tide_crystal_color black
tide_direnv_bg_color bryellow
tide_direnv_bg_color_denied brred
tide_direnv_color black
tide_direnv_color_denied black
tide_distrobox_bg_color brmagenta
tide_distrobox_color black
tide_docker_bg_color blue
Expand Down
18 changes: 18 additions & 0 deletions tests/_tide_item_direnv.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# RUN: %fish %s
_tide_parent_dirs

function _direnv
_tide_decolor (_tide_item_direnv)
end

set -e DIRENV_DIR
set -lx tide_direnv_icon ▼

_direnv # CHECK:

set -lx DIRENV_DIR
mock direnv status "echo Found RC allowed true"
_direnv # CHECK: ▼

mock direnv status "echo Found RC allowed false"
_direnv # CHECK: ▼

0 comments on commit 270b269

Please sign in to comment.