blob: e98abc1ed28dcaa8d6aeb33b08d691971c81776f (
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
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/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
from utils.sort import sort_entries
from utils.balance import print_balance
from utils.acc_regex import filter_accounts
def main():
args = get_arguments()
test_args(args)
if args.files:
result = []
for file in args.files:
result += read_ledger(file)
if len(args.verb) > 1:
result = filter_accounts(args.verb[1:], result)
if args.sort:
sort_entries(result, args.sort)
if args.verb[0] == 'print':
for ent in result:
print(ent)
elif args.verb[0] in ['register', 'reg', 'r']:
print_register(result)
elif args.verb[0] in ['balance', 'bal', 'b']:
print_balance(result)
if __name__ == '__main__':
main()
|