From 131443b7c5bacbb974048aec5c8aa0c44c3aa4bd Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Santos Souza de Miranda Date: Wed, 3 Sep 2025 11:11:41 -0300 Subject: [PATCH 1/3] Update CLI entry point in `pyproject.toml` --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b2a32db..97eedad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,4 +25,4 @@ Homepage = "https://github.com/gmbrax/Pilgrim/" Issues = "https://github.com/gmbrax/Pilgrim/issues" [project.scripts] -pilgrim = "epstein.command:main" \ No newline at end of file +epstein = "epstein.command:main" \ No newline at end of file -- 2.39.2 From 90aba43e1e5f80a22333e6913392620a8f14fc41 Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Santos Souza de Miranda Date: Wed, 3 Sep 2025 11:12:32 -0300 Subject: [PATCH 2/3] Add the ` Application ` class and integrate it into the CLI entry point --- src/epstein/application.py | 7 +++++++ src/epstein/command.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/epstein/application.py b/src/epstein/application.py index e69de29..f50cfa1 100644 --- a/src/epstein/application.py +++ b/src/epstein/application.py @@ -0,0 +1,7 @@ +class Application: + def __init__(self): + pass + + def run(self): + pass + \ No newline at end of file diff --git a/src/epstein/command.py b/src/epstein/command.py index afee10b..4fe2a08 100644 --- a/src/epstein/command.py +++ b/src/epstein/command.py @@ -1,7 +1,9 @@ -from epstein.application import * +from epstein.application import Application def main(): print("hello world") + app = Application() + app.run() if __name__ =="__main__": main() -- 2.39.2 From 7e138615b762bb78d1e6f34b88af2e14f909ae57 Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Santos Souza de Miranda Date: Wed, 3 Sep 2025 17:43:32 -0300 Subject: [PATCH 3/3] Expand the ` Application ` class with argument parsing and subcommands for PDF export and theme management. Integrate command handling logic. --- src/epstein/application.py | 47 ++++++++++++++++++++++++++++++++++++-- src/epstein/command.py | 2 ++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/epstein/application.py b/src/epstein/application.py index f50cfa1..78d1220 100644 --- a/src/epstein/application.py +++ b/src/epstein/application.py @@ -1,7 +1,50 @@ +import argparse +import sys + class Application: def __init__(self): - pass + self.args = self.__setup_args + + @property + def __setup_args(self): + parser = argparse.ArgumentParser(prog="epstein", + description='Test for PDF Export Module for pilgrim') + + subparsers = parser.add_subparsers(dest="command",required=True) + print_parser = subparsers.add_parser("print", help="generate the PDF file ") + print_parser.add_argument("-t", "--theme", required=True, help="Define the theme to use.") + print_parser.set_defaults(func=self.handle_print) + + + theme_parser = subparsers.add_parser("theme", help="Manage the themes") + theme_subparsers = theme_parser.add_subparsers(dest="theme_action", help="Actions for the themes" , required=True) + + theme_create_parser = theme_subparsers.add_parser("create", help="Create a new theme") + theme_create_parser.add_argument("-n", "--name", required=True, help="Name of the theme") + theme_create_parser.set_defaults(func=self.handle_theme_create) + + theme_list_parser = theme_subparsers.add_parser("list", help="List all the themes") + theme_list_parser.set_defaults(func=self.handle_theme_list) + + if len(sys.argv) == 2 and sys.argv[1] == 'theme': + theme_parser.print_help(sys.stderr) + sys.exit(1) + + if len(sys.argv) == 1: + parser.print_help(sys.stderr) + sys.exit(1) + + return parser.parse_args() + + def handle_print(self): + print("handle print") + + def handle_theme_create(self): + print("handle theme create") + + def handle_theme_list(self): + print("handle theme list") def run(self): - pass + self.args.func() \ No newline at end of file diff --git a/src/epstein/command.py b/src/epstein/command.py index 4fe2a08..f23e602 100644 --- a/src/epstein/command.py +++ b/src/epstein/command.py @@ -1,3 +1,5 @@ +import argparse + from epstein.application import Application def main(): -- 2.39.2