can get retirement contributions with grepping
parent
e25d52b141
commit
c3f7800dec
|
|
@ -8,5 +8,6 @@ type Config struct {
|
|||
NoRounding bool
|
||||
Depth int
|
||||
Reverse bool
|
||||
NoExchanging bool
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ func Main() {
|
|||
fs.BoolVar(&config.Query.NoRounding, "no-rounding", false, "no rounding")
|
||||
fs.IntVar(&config.Query.Depth, "depth", 0, "depth grouping")
|
||||
fs.BoolVar(&config.Query.Reverse, "r", false, "reverse printed accounts")
|
||||
fs.BoolVar(&config.Query.NoExchanging, "no-exchanging", true, "omit currency exchanges")
|
||||
if err := fs.Parse(os.Args[1:]); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -110,7 +111,17 @@ func Main() {
|
|||
|
||||
for _, transaction := range transactions {
|
||||
balances := ledger.Deltas(transaction).Like(likes...).Balances()
|
||||
if len(balances) > 0 {
|
||||
shouldPrint := false
|
||||
shouldPrint = shouldPrint || len(balances) > 2
|
||||
if config.Query.NoExchanging {
|
||||
shouldPrint = shouldPrint || len(balances) > 1
|
||||
for _, v := range balances {
|
||||
shouldPrint = shouldPrint || len(v) == 1
|
||||
}
|
||||
} else {
|
||||
shouldPrint = shouldPrint || len(balances) > 0
|
||||
}
|
||||
if shouldPrint {
|
||||
fmt.Printf("%s\t%s\n", transaction[0].Date, transaction[0].Description)
|
||||
FPrintBalances(os.Stdout, "\t\t", ledger.Deltas(transaction).Like(likes...).Balances())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue