-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
If output of program is redirected to a file for some reason, the colour codes should be suppressed.
This is how I can do the detection:
package main
import (
"os"
"fmt"
)
func main() {
if fileInfo, _ := os.Stdout.Stat(); (fileInfo.Mode() & os.ModeCharDevice) != 0 {
fmt.Println("Hello terminal")
} else {
fmt.Println("Who are you? You're not a terminal")
}
}
Just have to adapt that for this code
Metadata
Metadata
Assignees
Labels
No labels