Write writes output either directly to stdout, or through a pager, depending upon configuration.
(out string, conf config.Config)
| 12 | // Write writes output either directly to stdout, or through a pager, |
| 13 | // depending upon configuration. |
| 14 | func Write(out string, conf config.Config) { |
| 15 | // if no pager was configured, print the output to stdout and exit |
| 16 | if conf.Pager == "" { |
| 17 | fmt.Print(out) |
| 18 | os.Exit(0) |
| 19 | } |
| 20 | |
| 21 | // otherwise, pipe output through the pager |
| 22 | writeToPager(out, conf) |
| 23 | } |
| 24 | |
| 25 | // writeToPager writes output through a pager command |
| 26 | func writeToPager(out string, conf config.Config) { |
no test coverage detected