un-break shared
cicd / ci (push) Successful in 3m5s Details

main
Bel LaPointe 2025-10-31 07:28:26 -06:00
parent cc546d9b2d
commit b1cf639f39
3 changed files with 22 additions and 15 deletions

View File

@ -17,4 +17,5 @@ type Config struct {
}
Compact bool
GroupDate string
NoPercent bool
}

View File

@ -42,6 +42,7 @@ func Main() {
fs.StringVar(&config.CPI, "cpi", "", "path to cpi")
fs.StringVar(&config.GroupDate, "group-date", "^....-..-..", "date grouping")
fs.IntVar(&config.CPIYear, "cpiy", 0, "use cpi to convert usd to this year's value")
fs.BoolVar(&config.NoPercent, "no-percent", false, "compute percent")
if err := fs.Parse(os.Args[1:]); err != nil {
panic(err)
}
@ -146,6 +147,8 @@ func Main() {
Normalize(cpiNormalizer, "9")
cumulatives := make(ledger.Balances)
cumulativesFormat := "%s%.2f"
if !config.NoPercent {
var sum float64
for key := range balances {
if _, ok := cumulatives[key]; !ok {
@ -163,8 +166,10 @@ func Main() {
for key := range cumulatives {
cumulatives[key][ledger.USD] = 100 * cumulatives[key][ledger.USD] / sum
}
cumulativesFormat = "%.0f%%"
}
FPrintBalances(w, "", balances, cumulatives, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"), false, maxAccW, "%.0f%%")
FPrintBalances(w, "", balances, cumulatives, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"), false, maxAccW, cumulativesFormat)
case "gra": // graph
dateGrouping := "^[0-9]{4}-[0-9]{2}"
if period := config.Query.Period; !period.Empty() {

View File

@ -49,6 +49,7 @@ func main() {
"--depth=1",
"--usd",
"-n",
"--no-percent",
"bal", "^Bel", "^Zach",
)
main()