Minor CLI improvements
- Show Emojis on non-Windows platforms, instead of just macOS - Change help text for `pulumi logs` to clarify the logs are specific to a stack, not a project - Display stack name when showing logs - Have preamble text show to users for engine operations read a little nicer
This commit is contained in:
parent
1994c94b8b
commit
8f0dff3220
3 changed files with 22 additions and 17 deletions
|
@ -29,7 +29,7 @@ func newLogsCmd() *cobra.Command {
|
||||||
|
|
||||||
logsCmd := &cobra.Command{
|
logsCmd := &cobra.Command{
|
||||||
Use: "logs",
|
Use: "logs",
|
||||||
Short: "Show aggregated logs for a project",
|
Short: "Show aggregated logs for a stack",
|
||||||
Args: cmdutil.NoArgs,
|
Args: cmdutil.NoArgs,
|
||||||
Run: cmdutil.RunFunc(func(cmd *cobra.Command, args []string) error {
|
Run: cmdutil.RunFunc(func(cmd *cobra.Command, args []string) error {
|
||||||
s, err := requireStack(stack, false)
|
s, err := requireStack(stack, false)
|
||||||
|
@ -48,7 +48,8 @@ func newLogsCmd() *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf(
|
fmt.Printf(
|
||||||
colors.ColorizeText(colors.BrightMagenta+"Collecting logs since %s.\n\n"+colors.Reset),
|
colors.ColorizeText(colors.BrightMagenta+"Collecting logs for stack %s since %s.\n\n"+colors.Reset),
|
||||||
|
s.Name().String(),
|
||||||
startTime.Format(timeFormat),
|
startTime.Format(timeFormat),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -473,24 +473,28 @@ func (b *cloudBackend) GetStackCrypter(stackRef backend.StackReference) (config.
|
||||||
return &cloudCrypter{backend: b, stack: stack}, nil
|
return &cloudCrypter{backend: b, stack: stack}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
updateTextMap = map[string]struct {
|
||||||
|
previewText string
|
||||||
|
text string
|
||||||
|
}{
|
||||||
|
string(client.UpdateKindUpdate): {"update of", "Updating"},
|
||||||
|
string(client.UpdateKindRefresh): {"refresh of", "Refreshing"},
|
||||||
|
string(client.UpdateKindDestroy): {"destroy of", "Destroying"},
|
||||||
|
string(client.UpdateKindImport): {"import to", "Importing into"},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func getActionLabel(key string, dryRun bool) string {
|
func getActionLabel(key string, dryRun bool) string {
|
||||||
|
v := updateTextMap[key]
|
||||||
|
contract.Assert(v.previewText != "")
|
||||||
|
contract.Assert(v.text != "")
|
||||||
|
|
||||||
if dryRun {
|
if dryRun {
|
||||||
return "Previewing"
|
return "Previewing " + v.previewText
|
||||||
}
|
}
|
||||||
|
|
||||||
switch key {
|
return v.text
|
||||||
case string(client.UpdateKindUpdate):
|
|
||||||
return "Updating"
|
|
||||||
case string(client.UpdateKindRefresh):
|
|
||||||
return "Refreshing"
|
|
||||||
case string(client.UpdateKindDestroy):
|
|
||||||
return "Destroying"
|
|
||||||
case string(client.UpdateKindImport):
|
|
||||||
return "Importing"
|
|
||||||
}
|
|
||||||
|
|
||||||
contract.Failf("Should not get here.")
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type response string
|
type response string
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Emoji controls whether emojis will by default be printed in the output.
|
// Emoji controls whether emojis will by default be printed in the output.
|
||||||
var Emoji = (runtime.GOOS == "darwin")
|
var Emoji = (runtime.GOOS != "windows")
|
||||||
|
|
||||||
// EmojiOr returns the emoji string e if emojis are enabled, or the string or if emojis are disabled.
|
// EmojiOr returns the emoji string e if emojis are enabled, or the string or if emojis are disabled.
|
||||||
func EmojiOr(e, or string) string {
|
func EmojiOr(e, or string) string {
|
||||||
|
|
Loading…
Reference in a new issue