tide/functions/_tide_item_pulumi.fish

20 lines
733 B
Fish
Raw Permalink Normal View History

function _tide_item_pulumi
if path filter $_tide_parent_dirs/Pulumi.yaml | read -l yaml_path
if command -q sha1sum
2023-07-07 03:05:43 +03:00
echo -n "$yaml_path" | sha1sum | string match -qr "(?<path_hash>.{40})"
else if command -q shasum
2023-07-07 03:05:43 +03:00
echo -n "$yaml_path" | shasum | string match -qr "(?<path_hash>.{40})"
2023-07-07 03:20:14 +03:00
else
return
end
2023-07-07 03:23:47 +03:00
string match -qr 'name: *(?<project_name>.*)' <$yaml_path
2023-07-07 03:20:14 +03:00
set -l workspace_file "$HOME/.pulumi/workspaces/$project_name-$path_hash-workspace.json"
2023-07-07 03:20:14 +03:00
if test -e $workspace_file
string match -qr '"stack": *"(?<stack>.*)"' <$workspace_file
2023-07-07 03:20:14 +03:00
_tide_print_item pulumi $tide_pulumi_icon' ' $stack
end
end
end