-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (24 loc) · 1.14 KB
/
main.py
File metadata and controls
32 lines (24 loc) · 1.14 KB
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
from operation import *
import os
import configparser
import argparse
def get_arguments():
parser = argparse.ArgumentParser(description="A python script to track your SCM investment profits easily.To make this programm give an efficient output, be as accurate as you can when filling up the investment.ini file. It is recommended that you put the name exactly as they are on SCM.",
epilog="N.B. profit/loss is calculated after deducting the 15% steam tax.")
parser.add_argument("-s", "--short",action='store_true', help="generate a short report: name and net profit/loss")
parser.add_argument("-l","--long",action='store_true', help="generate a full detailed report of your investments")
return parser.parse_args()
def operations(choice):
if choice.long and choice.short:
print("Use either -s or -l to generate a report, not both.")
elif choice.long:
details()
elif choice.short:
shortlist()
else:
print("Please use -s or -l with the command to generate a report. For more help, use -h")
def main():
option = get_arguments()
operations(option)
if __name__ == "__main__":
main()