Feature: Listing banks

master
Matt Theissen 3 years ago
parent 4798693ba1
commit 2820217c8e

@ -1,10 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sqlite3 import sqlite3
import os import os
def selectBank(): def selectBank():
print('Make things to select the bank...') listBank()
def addBank(): def addBank():
bankName = input("What would you like to call this bank? ") bankName = input("What would you like to call this bank? ")
bankName = bankName+".db.sqlite" bankName = bankName+".db.sqlite"
@ -27,6 +26,14 @@ def addBank():
print(f'*** Added bank {bankName}') print(f'*** Added bank {bankName}')
print() print()
def listBank():
dirOutput = os.listdir()
matchs = [match for match in dirOutput if 'db.sqlite' in match]
print()
print('Banks found: ')
for i in matchs:
print(i.split(".")[0])
while True: while True:
print(""" print("""
1. Select a Bank. 1. Select a Bank.
@ -37,11 +44,11 @@ while True:
""") """)
mainOption = input("Choose an option: ") mainOption = input("Choose an option: ")
if mainOption == '1': if mainOption == '1':
print('Place function here.') selectBank()
elif mainOption == '2': elif mainOption == '2':
addBank() addBank()
elif mainOption == '3': elif mainOption == '3':
print('Place function here.') listBank()
elif mainOption == '4': elif mainOption == '4':
print('Place function here.') print('Place function here.')
elif mainOption == 'Q' or mainOption == 'q': elif mainOption == 'Q' or mainOption == 'q':