simonmichael / hledger

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

Support --sort for register command #2180

Open igxlin opened 4 months ago

igxlin commented 4 months ago

Look like currently hledger only print register in the order of date. The --sort option of ledger register is very helpful when users want to get the expenses of most amount. Hope to have that option in hledger.

--sort value-expression (-S)
                                 Sort  postings  by evaluating the given value-expression.  Note that a
                                 comma-separated list of expressions is allowed,  in  which  case  each
                                 sorting  term  is  used in order to determine the final ordering.  For
                                 example, to search by date and then amount, one would use:
                                       ledger reg --sort 'date, amount'
                                 The sort order may be controlled with the '-' sign.  For  example,  to
                                 sort in reverse chronological order:
                                       ledger reg --sort '-date'