From 64023478b70a0da5db87f120955e041ba29a5dfe Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 13 Oct 2025 10:08:11 -1000 Subject: [PATCH] imp:accounts: rename --positions to --locations for consistency with `print`. --positions still works, as a hidden flag. --- hledger/Hledger/Cli/Commands/Accounts.hs | 10 ++++++---- hledger/Hledger/Cli/Commands/Accounts.md | 4 ++-- hledger/hledger.m4.md | 2 +- hledger/shell-completion/hledger-completion.bash | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Accounts.hs b/hledger/Hledger/Cli/Commands/Accounts.hs index 6732e625e..7e94024ea 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.hs +++ b/hledger/Hledger/Cli/Commands/Accounts.hs @@ -40,14 +40,16 @@ accountsmode = hledgerCommandMode ,flagNone ["unused"] (setboolopt "unused") "list accounts declared but not used" ,flagNone ["find"] (setboolopt "find") "list the first account matched by the first argument (a case-insensitive infix regexp)" ,flagNone ["directives"] (setboolopt "directives") "show as account directives, for use in journals" - ,flagNone ["positions"] (setboolopt "positions") "also show where accounts were declared" + ,flagNone ["locations"] (setboolopt "locations") "also show where accounts were declared" ,flagNone ["types"] (setboolopt "types") "also show account types when known" ] ++ flattreeflags False ++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"] ) cligeneralflagsgroups1 - hiddenflags + (hiddenflags ++ + [flagNone ["positions"] (setboolopt "locations") "deprecated, use --locations instead" + ]) ([], Just $ argsFlag "[QUERY..]") -- | The accounts command. @@ -57,7 +59,7 @@ accounts opts@CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_r -- 1. identify the accounts we'll show let tree = tree_ ropts directives = boolopt "directives" rawopts - positions = boolopt "positions" rawopts + locations = boolopt "locations" rawopts types = boolopt "types" rawopts -- Modified queries. These may not work with boolean queries (#2371). -- a depth limit will clip and exclude account names later, but we don't want to exclude accounts at this stage @@ -115,7 +117,7 @@ accounts opts@CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_r (True, Just t) -> pad a <> " ; type: " <> T.pack (show t) _ -> "" showAcctDeclOrder a - | positions = + | locations = (if types then "," else pad a <> " ;") <> case lookup a $ jdeclaredaccounts j of Just adi -> diff --git a/hledger/Hledger/Cli/Commands/Accounts.md b/hledger/Hledger/Cli/Commands/Accounts.md index 59e02435f..187988102 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.md +++ b/hledger/Hledger/Cli/Commands/Accounts.md @@ -11,7 +11,7 @@ Flags: --find list the first account matched by the first argument (a case-insensitive infix regexp) --directives show as account directives, for use in journals - --positions also show where accounts were declared + --locations also show where accounts were declared --types also show account types when known -l --flat list/tree mode: show accounts as a flat list (default) @@ -33,7 +33,7 @@ With `--directives`, it shows valid account directives which could be pasted int This is useful together with `--undeclared` when updating your account declarations to satisfy `hledger check accounts`. -With `--positions`, it also shows the file and line number of each +With `--locations`, it also shows the file and line number of each account's declaration, if any, and the account's overall declaration order; these may be useful when troubleshooting account display order. diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 82ae12bc9..3a1d44695 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -2219,7 +2219,7 @@ Tips: - You can list accounts and their types, for troubleshooting: ```cli - $ hledger accounts --types [ACCTPAT] [type:TYPECODES] [-DEPTH] [--positions] + $ hledger accounts --types [ACCTPAT] [type:TYPECODES] [-DEPTH] ``` - It's a good idea to declare at least one account for each account type. diff --git a/hledger/shell-completion/hledger-completion.bash b/hledger/shell-completion/hledger-completion.bash index 0fc7f3bd4..7c3eabf32 100644 --- a/hledger/shell-completion/hledger-completion.bash +++ b/hledger/shell-completion/hledger-completion.bash @@ -540,13 +540,13 @@ read -r -d "" _hledger_complist_options_accounts <<"__TEXT__" --infer-equity --infer-market-prices --info +--locations --man --market --monthly --pending --period= --pivot= ---positions --pretty --quarterly --real