From ee0cb66c2221219449d1c148f4c52d8caed690f8 Mon Sep 17 00:00:00 2001 From: Mario Krajacic Date: Mon, 18 Mar 2024 19:20:52 +0100 Subject: [PATCH] Right-alight report numbers --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0344efb..38e3cf7 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "runtime" "sort" "strconv" + "strings" "sync" "time" ) @@ -337,7 +338,12 @@ func writeFile(data [][]string) (err error) { w := bufio.NewWriter(file) for _, row := range data { for i, cell := range row { - if _, err := fmt.Fprintf(w, "%-*s", widths[i]+2, cell); err != nil { + // If column is dobit or placeni porez, right-align it + if i == 3 || i == 5 { + if _, err := fmt.Fprintf(w, "%-*s", widths[i]+2, strings.Repeat(" ", widths[i]-len(cell))+cell); err != nil { + return err + } + } else if _, err := fmt.Fprintf(w, "%-*s", widths[i]+2, cell); err != nil { return err } }