2022-09-20 04:19:59 +03:00
|
|
|
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})"
|
2022-09-20 04:19:59 +03:00
|
|
|
else if command -q shasum
|
2023-07-07 03:05:43 +03:00
|
|
|
echo -n "$yaml_path" | shasum | string match -qr "(?<path_hash>.{40})"
|
2022-09-20 04:19:59 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
if test -n "$path_hash"
|
|
|
|
string match -rg 'name: *(.*)' <$yaml_path | read -l project_name
|
|
|
|
set -l workspace_file "$HOME/.pulumi/workspaces/$project_name-$path_hash-workspace.json"
|
|
|
|
|
|
|
|
if test -e $workspace_file
|
|
|
|
string match -rg '"stack": *"(.*)"' <$workspace_file | read -l stack
|
|
|
|
_tide_print_item pulumi $tide_pulumi_icon' ' $stack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|