MCPcopy Index your code
hub / github.com/cloudfoundry/cli / NewPluginUI

Function NewPluginUI

util/ui/ui.go:129–152  ·  view source on GitHub ↗

NewPluginUI will return a UI object where OUT and ERR are customizable.

(config Config, outBuffer io.Writer, errBuffer io.Writer)

Source from the content-addressed store, hash-verified

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) {
130 translateFunc, translationError := GetTranslationFunc(config)
131 if translationError != nil {
132 return nil, translationError
133 }
134
135 location := time.Now().Location()
136
137 return &UI{
138 In: nil,
139 Out: outBuffer,
140 OutForInteraction: outBuffer,
141 Err: errBuffer,
142 colorEnabled: configv3.ColorDisabled,
143 translate: translateFunc,
144 terminalLock: &sync.Mutex{},
145 Exiter: realExiter,
146 fileLock: &sync.Mutex{},
147 Interactor: realInteract,
148 IsTTY: config.IsTTY(),
149 TerminalWidth: config.TerminalWidth(),
150 TimezoneLocation: location,
151 }, nil
152}
153
154// NewTestUI will return a UI object where Out, In, and Err are customizable,
155// and colors are disabled

Callers 1

Calls 4

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

Tested by

no test coverage detected