Skip to content

Commit 5dde420

Browse files
committed
Added cache-file option.
I really need to clean up these files... way too many main()s floating around...
1 parent 42f9308 commit 5dde420

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LIA="lia"
1+
LIA=lia
22
INPUT1="test-files/test-input-small.csv"
33
INPUT2="test-files/test-numbered-input.csv"
44
OUTPUT="test-files/test-output.dat"
@@ -8,13 +8,13 @@ ACCOUNT="Liabilities:CreditCard:Ryan"
88

99

1010
run:
11-
python3 $(LIA) -f $(INPUT1) -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -c
11+
python3 $(LIA) -f $(INPUT1) -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -C
1212
run2:
13-
python3 $(LIA) -f $(INPUT2) -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -c
13+
python3 $(LIA) -f $(INPUT2) -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -C
1414
manual:
15-
python3 $(LIA) -m -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -c
15+
python3 $(LIA) -m -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -C
1616
cacheRun:
17-
python3 $(LIA) -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -c
17+
python3 $(LIA) -o $(OUTPUT) -a $(ACCOUNT) -r $(RULES) -C
1818
build:
1919
nuitka --recurse-all $(LIA)
2020

lia

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ def main():
2525
help="Manually write new Transactions instead of file import.",
2626
required=False)
2727
parser.add_argument('-o', '--output', help="output ledger file name", required=True)
28-
parser.add_argument('-c', '--color', action="store_true", help="Turns on the colored output", required=False)
28+
parser.add_argument('-C', '--color', action="store_true", help="Turns on the colored output",
29+
required=False)
30+
parser.add_argument('-c', '--cache', help="Defines the cache file location. Defaults to ~/.lia-cache.csv",
31+
required=False)
2932
parser.add_argument('-a', '--import-account', help="Default import account", required=True)
3033
parser.add_argument('-d', '--date-format', help="date-format", required=False)
3134
parser.add_argument('-w', '--overwrite', help="Overwrite output file. Defaults to append", required=False)
@@ -37,6 +40,8 @@ def main():
3740
inputFile = argSet('input', args, lambda key, value: open(value, "r"))
3841
ruleList = argSet('rules', args, lambda key, value: rules.parseRuleList(value))
3942
promptColor = argSet('color', args, lambda key, value: True)
43+
cacheFileSRC = argSet('cache', args, lambda key, value: value,
44+
failReturn= os.path.expanduser('~') + os.sep + ".lia-cache.csv")
4045

4146
# if(args['input']):
4247
# inputFile = open(args['input'], "r")
@@ -50,7 +55,6 @@ def main():
5055

5156
manualInput = args['manual']
5257
outputFile = backend.openOutputFile(args['output'], args['overwrite'])
53-
cacheFileSRC = os.path.expanduser('~') + os.sep + ".lia-cache.csv"
5458
importAccount = args['import_account']
5559
dateFormat = "%m/%d/%Y"
5660

lialib/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def argSet(key, args, fn, failReturn= False):
1717
## Main CLI Loop
1818
def main():
1919
""" The Main Class"""
20+
print("Lialib Main")
2021
parser = argparse.ArgumentParser(description="Convert csv files to Ledger")
2122
parser.add_argument('-f', '--input', help="Input csv file name", required=False)
2223
parser.add_argument('-r', '--rules', help="Automatic rules file", required=False)
@@ -25,6 +26,7 @@ def main():
2526
required=False)
2627
parser.add_argument('-o', '--output', help="output ledger file name", required=True)
2728
parser.add_argument('-c', '--color', action="store_true", help="Turns on the colored output", required=False)
29+
parser.add_argument('-s', '--cache', help="Defines the cache file location. Defaults to ~/.lia-cache.csv", required=False)
2830
parser.add_argument('-a', '--import-account', help="Default import account", required=True)
2931
parser.add_argument('-d', '--date-format', help="date-format", required=False)
3032
parser.add_argument('-w', '--overwrite', help="Overwrite output file. Defaults to append", required=False)

0 commit comments

Comments
 (0)