package escape import ( "io" "strings" "unicode/utf8" "pkg.jfrech.com/brief/decode" ) // TODO increase usage of this function throughout the codebase func HumanShellConsumption(raw string) string { b := new(strings.Builder) _, err := io.Copy(b, decode.TerminalFriendly(strings.NewReader(raw))) if err != nil { panic("unreachable") } return strings.NewReplacer( "\n", string(utf8.RuneError), "\r", string(utf8.RuneError), ).Replace(b.String()) }