buffering writes did NOT save any time
cicd / ci (push) Successful in 1m37s
Details
cicd / ci (push) Successful in 1m37s
Details
parent
8ade122378
commit
058874b566
|
|
@ -1,6 +1,7 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
|
|
@ -93,6 +94,9 @@ func Main() {
|
|||
deltas = deltas.Like(ledger.LikeWith(config.Query.With))
|
||||
}
|
||||
|
||||
w := bufio.NewWriter(os.Stdout)
|
||||
defer w.Flush()
|
||||
|
||||
switch cmd[:3] {
|
||||
case "bal":
|
||||
balances := deltas.Balances().
|
||||
|
|
@ -100,7 +104,7 @@ func Main() {
|
|||
KindaLike(q).
|
||||
KindaGroup(group).
|
||||
Nonzero()
|
||||
FPrintBalances(os.Stdout, "", balances, nil, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"))
|
||||
FPrintBalances(w, "", balances, nil, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"))
|
||||
case "reg":
|
||||
transactions := deltas.Transactions()
|
||||
|
||||
|
|
@ -117,8 +121,8 @@ func Main() {
|
|||
shouldPrint = shouldPrint || len(balances) > 0
|
||||
}
|
||||
if shouldPrint {
|
||||
fmt.Printf("%s\t%s\n", transaction[0].Date, transaction[0].Description)
|
||||
FPrintBalances(os.Stdout, "\t\t", balances, transactions[:i+1].Deltas().Like(q).Group(group).Balances().WithBPIsAt(bpis, transaction[0].Date).Nonzero(), config.Query.USDOnly, config.Query.Normalize, transaction[0].Date)
|
||||
fmt.Fprintf(w, "%s\t%s\n", transaction[0].Date, transaction[0].Description)
|
||||
FPrintBalances(w, "\t\t", balances, transactions[:i+1].Deltas().Like(q).Group(group).Balances().WithBPIsAt(bpis, transaction[0].Date).Nonzero(), config.Query.USDOnly, config.Query.Normalize, transaction[0].Date)
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue