diff --git a/main.py b/main.py index e60d391..7af56f4 100644 --- a/main.py +++ b/main.py @@ -14,13 +14,40 @@ from dotenv import load_dotenv from os import getenv from os.path import dirname, join +import typer + # Load environment variables from .env file dotenv_path = join(dirname(__file__), ".env") load_dotenv(dotenv_path) -# TODO: Flag --now to run temporarily and just execute hourly tasks instantly then exit # TODO: Logging # TODO: Email alerts + structure # TODO: Use typer for CLI # TODO: Fix readme and git.uthmn.com page for final release. # TODO: Error handling all round + +app = typer.Typer() + +@app.command() +def main(): + """ + Checks for updates and emails hourly for security, daily for general as a daemon. + """ + pass + +@app.command() +def now(): + """ + Checks for apt upgrades and emails them then exits. + """ + # TODO: Flag --now to run temporarily and just execute hourly tasks instantly then exit + pass + +@app.callback() +def callback(): + """ + Checks apt for upgrades and emails them + """ + +if __name__ == "__main__": + app() diff --git a/services/mail.py b/services/mail.py index 799a28f..507545d 100644 --- a/services/mail.py +++ b/services/mail.py @@ -117,5 +117,3 @@ def receive_emails(folder="INBOX", limit=50): print(f"Error receiving emails: {e}") return emails - -print(receive_emails())