From 2820217c8e1b3deca0c49423b662fa0452173021 Mon Sep 17 00:00:00 2001 From: Matt Theissen Date: Wed, 20 Apr 2022 00:41:16 -0500 Subject: [PATCH] Feature: Listing banks --- ddbank.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ddbank.py b/ddbank.py index 305fd93..c2f6d1e 100755 --- a/ddbank.py +++ b/ddbank.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 import sqlite3 import os - def selectBank(): - print('Make things to select the bank...') - + listBank() + def addBank(): bankName = input("What would you like to call this bank? ") bankName = bankName+".db.sqlite" @@ -27,6 +26,14 @@ def addBank(): print(f'*** Added bank {bankName}') 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: print(""" 1. Select a Bank. @@ -37,11 +44,11 @@ while True: """) mainOption = input("Choose an option: ") if mainOption == '1': - print('Place function here.') + selectBank() elif mainOption == '2': addBank() elif mainOption == '3': - print('Place function here.') + listBank() elif mainOption == '4': print('Place function here.') elif mainOption == 'Q' or mainOption == 'q':