diff options
-rw-r--r-- | doc/ledger.1 | 2 | ||||
-rw-r--r-- | doc/ledger3.texi | 5 | ||||
-rw-r--r-- | src/journal.cc | 3 | ||||
-rw-r--r-- | src/journal.h | 1 | ||||
-rw-r--r-- | src/session.cc | 5 | ||||
-rw-r--r-- | src/session.h | 2 |
6 files changed, 18 insertions, 0 deletions
diff --git a/doc/ledger.1 b/doc/ledger.1 index ecd97ecc..9544a071 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -381,6 +381,8 @@ See .It Fl \-meta Ar EXPR .It Fl \-meta-width Ar INT .It Fl \-monthly Pq Fl M +.It Fl \-no-aliases +Aliases are completely ignored. .It Fl \-no-color .It Fl \-no-pager .It Fl \-no-rounding diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 1a8fd9aa..48297889 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -2175,6 +2175,8 @@ alias Checking=Assets:Credit Union:Joint Checking Account Checking @end smallexample +The option @option{--no-aliases} completely disables alias expansion. + @item assert @c instance_t::assert_directive An assertion can throw an error if a condition is not met during @@ -5788,6 +5790,9 @@ $ ledger -f drewr3.dat bal --no-total --master-account HUMBUG $ 200.00 Mortgage:Principal @end smallexample +@item --no-aliases +Ledger does not expand any aliases if this option is specified. + @item --pedantic FIX THIS ENTRY @c FIXME thdox diff --git a/src/journal.cc b/src/journal.cc index 007acd7b..160abe06 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -173,6 +173,9 @@ account_t * journal_t::expand_aliases(string name) { // prevent infinite excursion. Each alias may only be expanded at most once. account_t * result = NULL; + if(no_aliases) + return result; + bool keep_expanding = true; std::list<string> already_seen; // loop until no expansion can be found diff --git a/src/journal.h b/src/journal.h index 270a2912..e4763482 100644 --- a/src/journal.h +++ b/src/journal.h @@ -132,6 +132,7 @@ public: bool check_payees; bool day_break; bool recursive_aliases; + bool no_aliases; payee_mappings_t payee_mappings; account_mappings_t account_mappings; accounts_map account_aliases; diff --git a/src/session.cc b/src/session.cc index 99467a43..b386607a 100644 --- a/src/session.cc +++ b/src/session.cc @@ -115,6 +115,8 @@ std::size_t session_t::read_data(const string& master_account) if (HANDLED(recursive_aliases)) journal->recursive_aliases = true; + if (HANDLED(no_aliases)) + journal->no_aliases = true; if (HANDLED(permissive)) journal->checking_style = journal_t::CHECK_PERMISSIVE; @@ -347,6 +349,9 @@ option_t<session_t> * session_t::lookup_option(const char * p) case 'm': OPT(master_account_); break; + case 'n': + OPT(no_aliases); + break; case 'p': OPT(price_db_); else OPT(price_exp_); diff --git a/src/session.h b/src/session.h index c2345362..d20ba74a 100644 --- a/src/session.h +++ b/src/session.h @@ -110,6 +110,7 @@ public: HANDLER(price_db_).report(out); HANDLER(price_exp_).report(out); HANDLER(recursive_aliases).report(out); + HANDLER(no_aliases).report(out); HANDLER(strict).report(out); HANDLER(value_expr_).report(out); } @@ -166,6 +167,7 @@ public: OPTION(session_t, strict); OPTION(session_t, value_expr_); OPTION(session_t, recursive_aliases); + OPTION(session_t, no_aliases); }; /** |