NewPluginUI will return a UI object where OUT and ERR are customizable.
(config Config, outBuffer io.Writer, errBuffer io.Writer)
| 127 | |
| 128 | // NewPluginUI will return a UI object where OUT and ERR are customizable. |
| 129 | func 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 |
no test coverage detected