aboutsummaryrefslogtreecommitdiff
path: root/ledger.py
blob: d9eb14f4cb3a414747a5716f46c3004a1fc955c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
from utils.args import get_arguments, test_args
from utils.read_file import read_ledger
from utils.register import print_register

def main():
    args = get_arguments()
    test_args(args)

    if args.files:
        result = []
        for file in args.files:
            result += read_ledger(file)

    if args.verb == 'print':
        for ent in result:
            print(ent)

    elif args.verb in ['register', 'reg', 'r']:
        print_register(result)


if __name__ == '__main__':
    main()