forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package_displayer.go
39 lines (33 loc) · 1.08 KB
/
package_displayer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package shared
import (
"code.cloudfoundry.org/cli/command"
)
type PackageDisplayer struct {
ui command.UI
config command.Config
}
func NewPackageDisplayer(ui command.UI, config command.Config) PackageDisplayer {
return PackageDisplayer{
ui: ui,
config: config,
}
}
func (display PackageDisplayer) DisplaySetupMessage(appName string, isDockerImage bool) error {
var flavorTextTemplate string
if isDockerImage {
flavorTextTemplate = "Creating docker package for app {{.AppName}} in org {{.CurrentOrg}} / space {{.CurrentSpace}} as {{.CurrentUser}}..."
} else {
flavorTextTemplate = "Uploading and creating bits package for app {{.AppName}} in org {{.CurrentOrg}} / space {{.CurrentSpace}} as {{.CurrentUser}}..."
}
currentUser, err := display.config.CurrentUser()
if err != nil {
return err
}
display.ui.DisplayTextWithFlavor(flavorTextTemplate, map[string]interface{}{
"AppName": appName,
"CurrentSpace": display.config.TargetedSpace().Name,
"CurrentOrg": display.config.TargetedOrganization().Name,
"CurrentUser": currentUser.Name,
})
return nil
}