can get retirement contributions with grepping
parent
e25d52b141
commit
c3f7800dec
|
|
@ -3,10 +3,11 @@ package cli
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Files FileList
|
Files FileList
|
||||||
Query struct {
|
Query struct {
|
||||||
Period Period
|
Period Period
|
||||||
Sort string
|
Sort string
|
||||||
NoRounding bool
|
NoRounding bool
|
||||||
Depth int
|
Depth int
|
||||||
Reverse bool
|
Reverse bool
|
||||||
|
NoExchanging bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ func Main() {
|
||||||
fs.BoolVar(&config.Query.NoRounding, "no-rounding", false, "no rounding")
|
fs.BoolVar(&config.Query.NoRounding, "no-rounding", false, "no rounding")
|
||||||
fs.IntVar(&config.Query.Depth, "depth", 0, "depth grouping")
|
fs.IntVar(&config.Query.Depth, "depth", 0, "depth grouping")
|
||||||
fs.BoolVar(&config.Query.Reverse, "r", false, "reverse printed accounts")
|
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 {
|
if err := fs.Parse(os.Args[1:]); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +111,17 @@ func Main() {
|
||||||
|
|
||||||
for _, transaction := range transactions {
|
for _, transaction := range transactions {
|
||||||
balances := ledger.Deltas(transaction).Like(likes...).Balances()
|
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)
|
fmt.Printf("%s\t%s\n", transaction[0].Date, transaction[0].Description)
|
||||||
FPrintBalances(os.Stdout, "\t\t", ledger.Deltas(transaction).Like(likes...).Balances())
|
FPrintBalances(os.Stdout, "\t\t", ledger.Deltas(transaction).Like(likes...).Balances())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue