feat: migrate all commands to use typer framework

This commit is contained in:
Lance Edgar 2024-07-01 11:21:34 -05:00
parent 4588fb8179
commit 4c9c321608
2 changed files with 22 additions and 4 deletions

View file

@ -27,7 +27,7 @@ dependencies = [
"furo",
"invoke",
"psycopg2",
"rattail[auth,db,bouncer]",
"rattail[db,bouncer]",
"Sphinx",
"Tailbone",
"tox",
@ -35,7 +35,7 @@ dependencies = [
[project.scripts]
rattail_tutorial = "rattail_tutorial.commands:main"
rattail_tutorial = "rattail_tutorial.commands:rattail_tutorial_typer"
[project.entry-points."paste.app_factory"]

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -26,11 +26,29 @@ Rattail Tutorial commands
import sys
from rattail import commands
import typer
from rattail import commands
from rattail.commands.typer import make_typer
from rattail_tutorial import __version__
rattail_tutorial_typer = make_typer(
name='rattail_tutorial',
help="Rattail Tutorial (custom Rattail system)"
)
@rattail_tutorial_typer.command()
def hello(
ctx: typer.Context,
):
"""
The requisite 'hello world' example
"""
sys.stdout.write("hello world!\n")
def main(*args):
"""
Main entry point for Rattail Tutorial command system