From b88d77fb2d0d5028a6f5670695dee6bec129501f Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Fri, 5 Apr 2024 11:57:45 -0400 Subject: ahhh sloppy fish, still needs fixing, esp with the vars --- .../functions/_tide_remove_unusable_items.fish | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 home-config/fish/functions/_tide_remove_unusable_items.fish (limited to 'home-config/fish/functions/_tide_remove_unusable_items.fish') 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 @@ +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 crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig + contains $item $tide_left_prompt_items $tide_right_prompt_items || continue + + set -l cli_names $item + switch $item + case distrobox # there is no 'distrobox' command inside the container + set cli_names distrobox-export # 'distrobox-export' and 'distrobox-host-exec' are available + case nix_shell + set cli_names nix nix-shell + case python + set cli_names python python3 + end + type --query $cli_names || set -a removed_items $item + end + + set -U _tide_left_items (for item in $tide_left_prompt_items + contains $item $removed_items || echo $item + end) + set -U _tide_right_items (for item in $tide_right_prompt_items + contains $item $removed_items || echo $item + end) +end -- cgit v1.2.3