MCPcopy
hub / github.com/cloudfoundry/cli / NewUI

Function NewUI

util/ui/ui.go:103–126  ·  view source on GitHub ↗

NewUI will return a UI object where Out is set to STDOUT, In is set to STDIN, and Err is set to STDERR

(config Config)

Source from the content-addressed store, hash-verified

101// NewUI will return a UI object where Out is set to STDOUT, In is set to
102// STDIN, and Err is set to STDERR
103func NewUI(config Config) (*UI, error) {
104 translateFunc, err := GetTranslationFunc(config)
105 if err != nil {
106 return nil, err
107 }
108
109 location := time.Now().Location()
110
111 return &UI{
112 In: os.Stdin,
113 Out: color.Output,
114 OutForInteraction: os.Stdout,
115 Err: os.Stderr,
116 colorEnabled: config.ColorEnabled(),
117 translate: translateFunc,
118 terminalLock: &sync.Mutex{},
119 Exiter: realExiter,
120 fileLock: &sync.Mutex{},
121 Interactor: realInteract,
122 IsTTY: config.IsTTY(),
123 TerminalWidth: config.TerminalWidth(),
124 TimezoneLocation: location,
125 }, nil
126}
127
128// NewPluginUI will return a UI object where OUT and ERR are customizable.
129func NewPluginUI(config Config, outBuffer io.Writer, errBuffer io.Writer) (*UI, error) {

Callers 9

mainFunction · 0.92
ui_for_app_test.goFile · 0.70
table_test.goFile · 0.70
ui_v7_test.goFile · 0.70
ui_test.goFile · 0.70
prompt_test.goFile · 0.70

Calls 5

GetTranslationFuncFunction · 0.85
NowMethod · 0.65
ColorEnabledMethod · 0.65
IsTTYMethod · 0.65
TerminalWidthMethod · 0.65

Tested by

no test coverage detected