From d40e1cab7cc6ffb058a36b81cac058ebabc1b182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Tue, 28 Jul 2015 10:18:22 +0200 Subject: [PATCH] breite dynamisch anpassen --- dict.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dict.go b/dict.go index e1b05a1..74bce24 100644 --- a/dict.go +++ b/dict.go @@ -56,12 +56,25 @@ func main() { return } - for i, _ := range left { + ml := 5 + + for _, v := range right { + if len(v) > ml { + ml = len(v) + } + } + + if ml > 40 { + ml = 40 + } + + for i, _ := range right { a := strings.Trim(right[i], `"`) b := strings.Trim(left[i], `"`) if a == "" { continue } - fmt.Printf("%25s → %s\n", a, b) + // TODO: wrap when len(a) > ml + fmt.Printf("%*s → %s\n", ml, a, b) } }