blob: 4b74307c17eb9442a71b0383421633cd5ed85f99 (
plain)
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
|
import sys
import os
import time
from ledger import *
def foo (str):
print "Hello:", str
def bar (str):
print "Goodbye:", str
register_option ("hello", "h:", foo)
register_option ("goodbye", "g:", bar)
args = process_arguments (sys.argv[1:])
process_environment (os.environ, "TEST_")
parser = TextualParser ()
register_parser (parser)
journal = Journal ()
parse_journal_file (args[0], journal)
class OutputTransaction (TransactionHandler):
def __call__ (self, xact):
print xact.entry.payee
handler = OutputTransaction()
handler = FilterTransactions (handler, "/Checking/")
for entry in journal:
for xact in entry:
handler (xact)
span = Interval ("monthly last year")
for date in span:
print time.strftime ("%c", time.localtime (date))
|