File diff 8c81eceb2cea → 35804db617a1
conservancy_beancount/reports/ledger.py
Show inline comments
...
 
@@ -78,6 +78,7 @@ from beancount.core import data as bc_data
 
from beancount.parser import printer as bc_printer
 

	
 
from . import core
 
from . import rewrite
 
from .. import books
 
from .. import cliutil
 
from .. import config as configmod
...
 
@@ -701,6 +702,7 @@ multiple times. You can specify a part of the account hierarchy, or an account
 
classification from metadata. If not specified, the default set adapts to your
 
search criteria.
 
""")
 
    cliutil.add_rewrite_rules_argument(parser)
 
    parser.add_argument(
 
        '--show-totals', '-S',
 
        metavar='ACCOUNT',
...
 
@@ -797,6 +799,14 @@ def main(arglist: Optional[Sequence[str]]=None,
 

	
 
    data.Account.load_from_books(entries, options)
 
    postings = data.Posting.from_entries(entries)
 
    for rewrite_path in args.rewrite_rules:
 
        try:
 
            ruleset = rewrite.RewriteRuleset.from_yaml(rewrite_path)
 
        except ValueError as error:
 
            logger.critical("failed loading rewrite rules from %s: %s",
 
                            rewrite_path, error.args[0])
 
            return cliutil.ExitCode.RewriteRulesError
 
        postings = ruleset.rewrite(postings)
 
    for search_term in args.search_terms:
 
        postings = search_term.filter_postings(postings)