simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
3.02k stars 321 forks source link

greppable balance report mode showing full account names and tree structure #1550

Open simonmichael opened 3 years ago

simonmichael commented 3 years ago

Greg Risko (?) requested a balance report display mode that shows both the full account names, and a name on every line (like list mode) and also shows the tree structure with indentation (like tree mode). I think the wish is that the default balance command output is easy to understand and easy to process with unix tools like grep. The current tree-mode balance report can't be easily grepped because multicommodity balances are shown on multiple lines by default, with the account name only on one of those lines.

In my mind the balancesheet and incomestatement commands are intended to be the first and most-easily-understood reports run by new users, with balance being more of a power user command. Perhaps Greg avoids those because they're not so greppable either - multicommodity balances will be shown on one line, and probably elided.

So we should explore this. When would this mode be activated ? Must we add yet another flag ? What will it look like and how clear will it be in practice ?

simonmichael commented 3 years ago

Eg here's the current output of a simple balance report in tree mode with multicommodity balances:

$ hledger -f examples/bcexample.hledger bal -N --tree assets:us:etrade
           70.00 GLD
          17.00 ITOT
         5120.50 USD
           36.00 VEA
          294.00 VHT  Assets:US:ETrade
         5120.50 USD    Cash
           70.00 GLD    GLD
          17.00 ITOT    ITOT
           36.00 VEA    VEA
          294.00 VHT    VHT

And here's what I think is being proposed:

           70.00 GLD  Assets:US:ETrade
          17.00 ITOT  Assets:US:ETrade
         5120.50 USD  Assets:US:ETrade
           36.00 VEA  Assets:US:ETrade
          294.00 VHT  Assets:US:ETrade
         5120.50 USD    Cash
           70.00 GLD    GLD
          17.00 ITOT    ITOT
           36.00 VEA    VEA
          294.00 VHT    VHT
simonmichael commented 3 years ago

Correction, here's what I think is being proposed:

           70.00 GLD  Assets:US:ETrade
          17.00 ITOT  Assets:US:ETrade
         5120.50 USD  Assets:US:ETrade
           36.00 VEA  Assets:US:ETrade
          294.00 VHT  Assets:US:ETrade
         5120.50 USD    Assets:US:ETrade:Cash
           70.00 GLD    Assets:US:ETrade:GLD
          17.00 ITOT    Assets:US:ETrade:ITOT
           36.00 VEA    Assets:US:ETrade:VEA
          294.00 VHT    Assets:US:ETrade:VHT
adept commented 3 years ago

FWIW, I like it. I often pipe reports into fuzzy finders like fzf or sk, and this output would be way better for searching and browsing

On Sun, May 2, 2021 at 9:32 PM Simon Michael @.***> wrote:

Correction, here's what I think is being proposed:

       70.00 GLD  Assets:US:ETrade
      17.00 ITOT  Assets:US:ETrade
     5120.50 USD  Assets:US:ETrade
       36.00 VEA  Assets:US:ETrade
      294.00 VHT  Assets:US:ETrade
     5120.50 USD    Assets:US:ETrade:Cash
       70.00 GLD    Assets:US:ETrade:GLD
      17.00 ITOT    Assets:US:ETrade:ITOT
       36.00 VEA    Assets:US:ETrade:VEA
      294.00 VHT    Assets:US:ETrade:VHT

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/simonmichael/hledger/issues/1550#issuecomment-830867430, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA42KTZCQKCOTDSQZKIALDTLWZEJANCNFSM437CWW7A .

-- D. Astapov