diff --git a/.gitignore b/.gitignore index e9aa45f..98e6ef6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ *.db -venv/ diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6ba386e..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -tabulate==0.8.10 diff --git a/start.py b/start.py deleted file mode 100644 index dfe9c9f..0000000 --- a/start.py +++ /dev/null @@ -1,59 +0,0 @@ -import argparse -import sqlite3 -from tabulate import tabulate - -def parse_args(): - """ - Parses the arguments from the CLI - """ - parser = argparse.ArgumentParser(description="Testtool Adress Changes") - parser.add_argument( - '-c', '--create', - help='Creates an example database', - action='store_true' - ) - parser.add_argument( - '-i', '--insert', - help='insert some example data', - action='store_true' - ) - parser.add_argument( - '-p', '--print', - choices=['table', 'string'], - default='table', - help='prints all the cells from the table', - ) - - return parser.parse_args() - - -def execute_sql(args): - db = sqlite3.connect("test.db") - cur = db.cursor() - print(args.print) - if args.create: - print("Creating") - with open ('sql/create_db.sql', 'r') as sql_file: - cur.executescript(sql_file.read()) - elif args.insert: - print("insert") - with open ('sql/insert_data.sql', 'r') as sql_file: - cur.executescript(sql_file.read()) - elif args.print: - cur.execute("SELECT * from customers") - if args.print == 'table': - print(tabulate(cur.fetchall())) - else: - print(cur.fetchall()) - db.commit() - db.close() - - - -def main(): - args = parse_args() - execute_sql(args) - - -if __name__ == '__main__': - main()