diff --git a/pyproject.toml b/pyproject.toml index 52da7ba..1ed4a09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ [project.scripts] cs50-final-project = "cs50_final_project:main" +start = "cs50_final_project.main:app" [build-system] requires = ["uv_build>=0.12.5,<0.13.0"] diff --git a/src/cs50_final_project/db.py b/src/cs50_final_project/db.py index 76576c8..6eba37e 100644 --- a/src/cs50_final_project/db.py +++ b/src/cs50_final_project/db.py @@ -2,7 +2,7 @@ import sqlite3 import typer -from .helpers import create_db +from cs50_final_project.helpers import create_db def db_init() -> None: diff --git a/src/cs50_final_project/helpers.py b/src/cs50_final_project/helpers.py index 99b1ac7..1a636f0 100644 --- a/src/cs50_final_project/helpers.py +++ b/src/cs50_final_project/helpers.py @@ -9,12 +9,12 @@ def create_cursor(conn): def create_db(conn): cursor = create_cursor(conn) cursor.execute(""" - CREATE TABLE IF NOT EXISTS events - id INTEGER PRIMARY KEY AUTOINCREMENT - name TEXT NOT NULL - description TEXT - start_time DATETIME NOT NULL - length INT NOT NULL - all_day BOOL NOT NULL + CREATE TABLE IF NOT EXISTS events( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL, + description TEXT, + start_time DATETIME NOT NULL, + length INT NOT NULL, + all_day BOOL NOT NULL, date_created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP - """); + )"""); diff --git a/src/cs50_final_project/main.py b/src/cs50_final_project/main.py index 4d19483..17b5bf0 100644 --- a/src/cs50_final_project/main.py +++ b/src/cs50_final_project/main.py @@ -1,6 +1,37 @@ -import sqlite3 - import typer -from .db import db_init +from cs50_final_project.db import db_init + +app = typer.Typer(help="Calendar Clash") + +@app.command() +def setup(): + """Begin the application by creating the events database if this is the first time running.""" + typer.echo("Setting up the database") + + db_init() + + typer.echo("Events Database successfully created") + +@app.command() +def say(): + print("hello") + +@app.command() +def add(): + name = input("Event Name: ") + day = input("Day of Event: ") + time = input("Time of Event: ") + length = input("Length of Event: ") + description = input("Description of Event: ") + + print(name) + print(day) + print(time) + print(length) + print(description) + + +if __name__ == "__main__": + app()