~trufas/ledgeroni

1d958fcee83fcbdb80ff21aac97e934a8022e5c9 — Rafael Castillo 1 year, 11 months ago e14e037
Add verification to all commands
3 files changed, 14 insertions(+), 1 deletions(-)

M ledgeroni/commands/balance.py
M ledgeroni/commands/print.py
M ledgeroni/commands/register.py
M ledgeroni/commands/balance.py => ledgeroni/commands/balance.py +7 -0
@@ 28,6 28,13 @@ def print_balance(ctx, filter_strs):
    for filename in ctx.obj.get('LEDGER_FILES', []):
        journal.add_from_file(filename)

    errors = journal.verify_transaction_balances()
    if errors:
        for error in errors:
            errstr = 'ERROR! Transaction unbalanced: {}'.format(error.header)
            click.echo(errstr, err=True)
        sys.exit(1)

    aggregate.add_from_journal(journal)

    balances = list(aggregate.iter_aggregates())

M ledgeroni/commands/print.py => ledgeroni/commands/print.py +0 -1
@@ 31,7 31,6 @@ def print_transactions(ctx, filter_strs):
            click.echo(errstr, err=True)
        sys.exit(1)


    if sorter:
        sorter.sort_journal(journal)


M ledgeroni/commands/register.py => ledgeroni/commands/register.py +7 -0
@@ 53,6 53,13 @@ def print_register(ctx, filter_strs):
    for filename in ctx.obj.get('LEDGER_FILES', []):
        journal.add_from_file(filename)

    errors = journal.verify_transaction_balances()
    if errors:
        for error in errors:
            errstr = 'ERROR! Transaction unbalanced: {}'.format(error.header)
            click.echo(errstr, err=True)
        sys.exit(1)

    if sorter:
        sorter.sort_journal(journal)