MCPcopy Index your code
hub / github.com/coder/coder / isTTYWriter

Function isTTYWriter

cli/root.go:1127–1140  ·  view source on GitHub ↗
(inv *serpent.Invocation, writer io.Writer)

Source from the content-addressed store, hash-verified

1125}
1126
1127func 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.

Callers 2

isTTYOutFunction · 0.85
isTTYErrFunction · 0.85

Calls 1

IsTerminalMethod · 0.80

Tested by

no test coverage detected