package inspect import ( "fmt" "os" "strings" "github.com/logrusorgru/aurora/v4" ) var ( aura *aurora.Aurora ) func setupAura(coloured bool) { var hyperlinks bool if coloured { switch os.Getenv("TERM") { case "xterm-kitty": hyperlinks = true } } aura = aurora.New(aurora.WithColors(coloured), aurora.WithHyperlinks(hyperlinks)) } func displayErr(err error, filename string) { fmt.Fprintf(os.Stderr, "%s: ", displayFilename(filename)) fmt.Fprintf(os.Stderr, "%v\n", aura.Red(err)) } func displayFilename(filename string) aurora.Value { switch { case strings.HasPrefix(filename, "https://"): return aura.Hyperlink(filename, filename) case filename == "-": return aura.Gray(12, "(stdin)") default: return aura.Blue(filename) } }