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 --- home-config/fish/functions/_tide_item_pulumi.fish | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 home-config/fish/functions/_tide_item_pulumi.fish (limited to 'home-config/fish/functions/_tide_item_pulumi.fish') diff --git a/home-config/fish/functions/_tide_item_pulumi.fish b/home-config/fish/functions/_tide_item_pulumi.fish new file mode 100644 index 0000000..6302a7e --- /dev/null +++ b/home-config/fish/functions/_tide_item_pulumi.fish @@ -0,0 +1,19 @@ +function _tide_item_pulumi + if path filter $_tide_parent_dirs/Pulumi.yaml | read -l yaml_path + if command -q sha1sum + echo -n "$yaml_path" | sha1sum | string match -qr "(?.{40})" + else if command -q shasum + echo -n "$yaml_path" | shasum | string match -qr "(?.{40})" + else + return + end + + string match -qr 'name: *(?.*)' <$yaml_path + set -l workspace_file "$HOME/.pulumi/workspaces/$project_name-$path_hash-workspace.json" + + if test -e $workspace_file + string match -qr '"stack": *"(?.*)"' <$workspace_file + _tide_print_item pulumi $tide_pulumi_icon' ' $stack + end + end +end -- cgit v1.2.3