Initialize a View with the given streams, a disabled colorize object, and a no-op configSources callback.
(streams *terminal.Streams)
| 59 | // Initialize a View with the given streams, a disabled colorize object, and a |
| 60 | // no-op configSources callback. |
| 61 | func NewView(streams *terminal.Streams) *View { |
| 62 | return &View{ |
| 63 | streams: streams, |
| 64 | colorize: &colorstring.Colorize{ |
| 65 | Colors: colorstring.DefaultColors, |
| 66 | Disable: true, |
| 67 | Reset: true, |
| 68 | }, |
| 69 | configSources: func() map[string]*hcl.File { return nil }, |
| 70 | diagsPrinter: func(severity tfdiags.Severity, msg string) { |
| 71 | if severity == tfdiags.Error { |
| 72 | _, _ = streams.Eprint(msg) |
| 73 | } else { |
| 74 | _, _ = streams.Print(msg) |
| 75 | } |
| 76 | }, |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | // SetRunningInAutomation modifies the view's "running in automation" flag, |
| 81 | // which causes some slight adjustments to certain messages that would normally |