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
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -93,6 +94,9 @@ func Main() {
|
||||||
deltas = deltas.Like(ledger.LikeWith(config.Query.With))
|
deltas = deltas.Like(ledger.LikeWith(config.Query.With))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w := bufio.NewWriter(os.Stdout)
|
||||||
|
defer w.Flush()
|
||||||
|
|
||||||
switch cmd[:3] {
|
switch cmd[:3] {
|
||||||
case "bal":
|
case "bal":
|
||||||
balances := deltas.Balances().
|
balances := deltas.Balances().
|
||||||
|
|
@ -100,7 +104,7 @@ func Main() {
|
||||||
KindaLike(q).
|
KindaLike(q).
|
||||||
KindaGroup(group).
|
KindaGroup(group).
|
||||||
Nonzero()
|
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":
|
case "reg":
|
||||||
transactions := deltas.Transactions()
|
transactions := deltas.Transactions()
|
||||||
|
|
||||||
|
|
@ -117,8 +121,8 @@ func Main() {
|
||||||
shouldPrint = shouldPrint || len(balances) > 0
|
shouldPrint = shouldPrint || len(balances) > 0
|
||||||
}
|
}
|
||||||
if shouldPrint {
|
if shouldPrint {
|
||||||
fmt.Printf("%s\t%s\n", transaction[0].Date, transaction[0].Description)
|
fmt.Fprintf(w, "%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)
|
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:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue