better verbose output

This commit is contained in:
Özgür Kesim 2024-12-08 23:40:09 +01:00
parent 7511c09c31
commit ba4c34b592
Signed by: oec
GPG Key ID: F136A7F922D018D7

View File

@ -56,11 +56,12 @@ func main() {
cmd.Stdout = stdout
cmd.Stderr = stderr
samfile = filepath.Base(samfile)
if e = cmd.Run(); e != nil {
if _, ok := e.(*exec.ExitError); ok {
str := stderr.String()
if len(samfile) != 0 {
samfile = "./" + filepath.Base(samfile)
str = strings.ReplaceAll(str, "stdin, open_line is ", samfile+":")
str = pos_rx.ReplaceAllString(str, fmt.Sprintf("%s:$1:#$2", samfile))
}
@ -117,7 +118,7 @@ func main() {
func pretty(e []textdiff.Edit, p string) string {
b := &bytes.Buffer{}
for _, e := range e {
fmt.Fprintf(b, "%s:#%d,#%d\n", p, e.Start, e.End)
fmt.Fprintf(b, "%s:#%d,#%d: »%s«\n", p, e.Start, e.End, e.New)
}
return b.String()
}