(inv *serpent.Invocation, writer io.Writer)
| 1125 | } |
| 1126 | |
| 1127 | func isTTYWriter(inv *serpent.Invocation, writer io.Writer) bool { |
| 1128 | // If the `--force-tty` command is available, and set, |
| 1129 | // assume we're in a tty. This is primarily for cases on Windows |
| 1130 | // where we may not be able to reliably detect this automatically (ie, tests) |
| 1131 | forceTty, err := inv.ParsedFlags().GetBool(varForceTty) |
| 1132 | if forceTty && err == nil { |
| 1133 | return true |
| 1134 | } |
| 1135 | file, ok := writer.(*os.File) |
| 1136 | if !ok { |
| 1137 | return false |
| 1138 | } |
| 1139 | return isatty.IsTerminal(file.Fd()) |
| 1140 | } |
| 1141 | |
| 1142 | // Example represents a standard example for command usage, to be used |
| 1143 | // with FormatExamples. |
no test coverage detected