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