diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index b0e3783f5..e0f36cb77 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -848,10 +848,12 @@ Match real or virtual postings respectively. Match unmarked, pending, or cleared transactions respectively. **`type:ACCTTYPES`**\ -Match by account type (see [Declaring accounts > Account types](#account-types)). +Match by account type (see ). `ACCTTYPES` is one or more of the single-letter account type codes `ALERXCV`, case insensitive. Eg: `hledger bal type:AL` shows asset and liability balances. +Note: certain kinds of account alias can disrupt this, see +[Rewriting accounts > Aliases and account types](#aliases-and-account-types). **`tag:REGEX[=REGEX]`**\ Match by tag name, and optionally also by tag value. @@ -3337,6 +3339,34 @@ $ hledger print --alias old="new USD" | hledger -f- print other ``` +### Aliases and account types + +If an account with a type declaration is renamed by an alias, +normally the account type remains in effect. + +However, renaming in a way that reshapes the account tree +(eg renaming parent accounts but not their children, or vice versa) +could prevent child accounts from inheriting the account type of their parents. + + +Secondly, if an account's type is being inferred from its name, +renaming it by an alias could prevent or alter that. + + +If you are using account aliases and the [`type:` query](#queries) is not matching accounts as you expect, +try troubleshooting with the accounts command, eg something like: + +```journal +$ hledger accounts --alias assets=bassetts type:a +``` + ## Default parent account You can specify a parent account which will be prepended to all accounts