We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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:
Just have to adapt that for this code
The text was updated successfully, but these errors were encountered: