salmon-account-74572
05/04/2022, 8:19 PMpulumi stack ls
(or making an equivalent API call), is there any way to determine the active stack for a Pulumi project? I'm not seeing anything in the stack-specific YAML files that would denote active or not.echoing-dinner-19531
05/04/2022, 8:32 PMfunc (pw *projectWorkspace) settingsPath() string {
uniqueFileName := string(pw.name) + "-" + sha1HexString(pw.project) + "-" + WorkspaceFile
path, err := GetPulumiPath(WorkspaceDir, uniqueFileName)
contract.AssertNoErrorf(err, "could not get workspace path")
return path
}
// sha1HexString returns a hex string of the sha1 hash of value.
func sha1HexString(value string) string {
// nolint: gosec
h := sha1.New()
_, err := h.Write([]byte(value))
contract.AssertNoError(err)
return hex.EncodeToString(h.Sum(nil))
}
So you could get the sha1 hex string of the Pulumi.yaml file then look it up there, but
A) That's horrible just use pulumi ls
B) This is not a supported interface and we'll probably move those files to somewhere more sensible at some point
But that's the state of things now if the risk tradeoff is worth it to you.salmon-account-74572
05/04/2022, 10:05 PMpowerline-go
(https://github.com/justjanne/powerline-go). Doing something local would generally result in lower latency (useful for a prompt) than having to call out to the Pulumi service.echoing-dinner-19531
05/04/2022, 10:13 PMpulumi stack --show-name
salmon-account-74572
05/04/2022, 10:17 PMechoing-dinner-19531
05/04/2022, 10:34 PMcalm-jackal-58777
05/05/2022, 10:08 AMechoing-dinner-19531
05/05/2022, 10:13 AMpulumi stack --show-name
was recently changed to be much faster (hopefully fast enough for a PS1 prompt) I'll nudge Aaron to see about changing starship to try using it as well.calm-jackal-58777
05/05/2022, 10:55 AMechoing-dinner-19531
05/05/2022, 11:25 AMsalmon-account-74572
05/05/2022, 2:27 PM~/.pulumi/workspaces
. I have a fork of powerline-go
working using pulumi stack --show-name
, but there is a noticeable delay in the prompt. I’ll have to try parsing the JSON files and see if that works better.