diff options
author | Ryan Schanzenbacher <ryan@rschanz.org> | 2024-04-05 11:57:45 -0400 |
---|---|---|
committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2024-04-05 11:57:45 -0400 |
commit | b88d77fb2d0d5028a6f5670695dee6bec129501f (patch) | |
tree | 2536b0461d297e647cf07157641c9b1223339adf /home-config/fish/functions/_tide_remove_unusable_items.fish | |
parent | 776a7ca55d2d2c3f396de91db1c6c3c5065012cd (diff) |
ahhh sloppy fish, still needs fixing, esp with the vars
Diffstat (limited to 'home-config/fish/functions/_tide_remove_unusable_items.fish')
-rw-r--r-- | home-config/fish/functions/_tide_remove_unusable_items.fish | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/home-config/fish/functions/_tide_remove_unusable_items.fish b/home-config/fish/functions/_tide_remove_unusable_items.fish new file mode 100644 index 0000000..deb4c10 --- /dev/null +++ b/home-config/fish/functions/_tide_remove_unusable_items.fish | |||
@@ -0,0 +1,25 @@ | |||
1 | function _tide_remove_unusable_items | ||
2 | # Remove tool-specific items for tools the machine doesn't have installed | ||
3 | set -l removed_items | ||
4 | for item in aws crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig | ||
5 | contains $item $tide_left_prompt_items $tide_right_prompt_items || continue | ||
6 | |||
7 | set -l cli_names $item | ||
8 | switch $item | ||
9 | case distrobox # there is no 'distrobox' command inside the container | ||
10 | set cli_names distrobox-export # 'distrobox-export' and 'distrobox-host-exec' are available | ||
11 | case nix_shell | ||
12 | set cli_names nix nix-shell | ||
13 | case python | ||
14 | set cli_names python python3 | ||
15 | end | ||
16 | type --query $cli_names || set -a removed_items $item | ||
17 | end | ||
18 | |||
19 | set -U _tide_left_items (for item in $tide_left_prompt_items | ||
20 | contains $item $removed_items || echo $item | ||
21 | end) | ||
22 | set -U _tide_right_items (for item in $tide_right_prompt_items | ||
23 | contains $item $removed_items || echo $item | ||
24 | end) | ||
25 | end | ||