diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 5dbc846..8d0048a 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -2,6 +2,7 @@ package cli import ( "flag" + "fmt" "os" "slices" @@ -46,6 +47,10 @@ func Main() { panic(err) } + if period := config.Query.Period; period != "" { + panic(period) + } + if depth := config.Query.Depth; depth > 0 { panic(depth) } @@ -60,26 +65,22 @@ func Main() { } slices.Sort(keys) - depth := 0 - previous := "" - for i := range keys { - key := keys[i] - - if isSameDepth := func() bool { - return false - }(); isSameDepth { - } else if isDeeper := func() bool { - return false - }(); isDeeper { - } else if lessDeep := func() int { - return 0 - }(); true { + max := 0 + for _, k := range keys { + if n := len(k); n > max { + max = n } - - previous = key } - panic(balances.Debug()) + format := fmt.Sprintf("%%-%ds\t%%s%%.2f\n", max) + for _, key := range keys { + for currency, v := range balances[key] { + if currency != "$" { + currency += " " + } + fmt.Printf(format, key, currency, v) + } + } case "reg": // register := deltas.Register() default: