github.com/orange-cloudfoundry/cli@v7.1.0+incompatible/command/v6/shared/package_displayer.go (about) 1 package shared 2 3 import ( 4 "code.cloudfoundry.org/cli/command" 5 ) 6 7 type PackageDisplayer struct { 8 ui command.UI 9 config command.Config 10 } 11 12 func NewPackageDisplayer(ui command.UI, config command.Config) PackageDisplayer { 13 return PackageDisplayer{ 14 ui: ui, 15 config: config, 16 } 17 } 18 19 func (display PackageDisplayer) DisplaySetupMessage(appName string, isDockerImage bool) error { 20 var flavorTextTemplate string 21 if isDockerImage { 22 flavorTextTemplate = "Creating docker package for app {{.AppName}} in org {{.CurrentOrg}} / space {{.CurrentSpace}} as {{.CurrentUser}}..." 23 } else { 24 flavorTextTemplate = "Uploading and creating bits package for app {{.AppName}} in org {{.CurrentOrg}} / space {{.CurrentSpace}} as {{.CurrentUser}}..." 25 } 26 27 currentUser, err := display.config.CurrentUser() 28 if err != nil { 29 return err 30 } 31 display.ui.DisplayTextWithFlavor(flavorTextTemplate, map[string]interface{}{ 32 "AppName": appName, 33 "CurrentSpace": display.config.TargetedSpace().Name, 34 "CurrentOrg": display.config.TargetedOrganization().Name, 35 "CurrentUser": currentUser.Name, 36 }) 37 38 return nil 39 }