Skip to content

Commit

Permalink
imp: doc: Document new regular expression limited depth.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xitian9 authored and simonmichael committed Dec 2, 2024
1 parent 5ab13e8 commit bf8575f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hledger/Hledger/Cli/CliOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ reportflags = [
,flagNone ["pending","P"] (setboolopt "pending") "include only pending postings/transactions"
,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/transactions\n(-U/-P/-C can be combined)"
,flagNone ["real","R"] (setboolopt "real") "include only non-virtual postings"
,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "NUM" "or -NUM: show only top NUM levels of accounts"
,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "DEPTHEXP" "if a number (or -NUM): show only top NUM levels of accounts. If REGEXP=NUM, only apply limiting to accounts matching the regular expression."
,flagNone ["empty","E"] (setboolopt "empty") "Show zero items, which are normally hidden.\nIn hledger-ui & hledger-web, do the opposite."

-- valuation
Expand Down
10 changes: 10 additions & 0 deletions hledger/hledger.m4.md
Original file line number Diff line number Diff line change
Expand Up @@ -5100,6 +5100,16 @@ reports will show accounts only to the specified depth, hiding deeper subaccount
Use this when you want a summary with less detail.
This flag has the same effect as a `depth:` query argument: `depth:2`, `--depth=2` or `-2` are equivalent.

A regular expression can also be provided to limit the accounts to which the depth limit applies.
This allows for different accounts to be limited to different levels, for example:
`--depth assets=2`, `depth:assets=2` will both limit accounts matching `assets` to depth 2.
If more than one regular expression matches, the most specific one will be used, i.e. the one which
matches latest as you progress up the parents of the account.
For example, `--depth savings=2 --depth assets=1` will clip to depth 2 when
matching `assets:bank:savings`, as it matches only the full account name while `assets` also
matches a parent.


# Queries

One of hledger's strengths is being able to quickly report on a precise subset of your data.
Expand Down

0 comments on commit bf8575f

Please sign in to comment.