feat: migrate all commands to use typer
framework
This commit is contained in:
parent
4588fb8179
commit
4c9c321608
|
@ -27,7 +27,7 @@ dependencies = [
|
||||||
"furo",
|
"furo",
|
||||||
"invoke",
|
"invoke",
|
||||||
"psycopg2",
|
"psycopg2",
|
||||||
"rattail[auth,db,bouncer]",
|
"rattail[db,bouncer]",
|
||||||
"Sphinx",
|
"Sphinx",
|
||||||
"Tailbone",
|
"Tailbone",
|
||||||
"tox",
|
"tox",
|
||||||
|
@ -35,7 +35,7 @@ dependencies = [
|
||||||
|
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
rattail_tutorial = "rattail_tutorial.commands:main"
|
rattail_tutorial = "rattail_tutorial.commands:rattail_tutorial_typer"
|
||||||
|
|
||||||
|
|
||||||
[project.entry-points."paste.app_factory"]
|
[project.entry-points."paste.app_factory"]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2019 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -26,11 +26,29 @@ Rattail Tutorial commands
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from rattail import commands
|
import typer
|
||||||
|
|
||||||
|
from rattail import commands
|
||||||
|
from rattail.commands.typer import make_typer
|
||||||
from rattail_tutorial import __version__
|
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):
|
def main(*args):
|
||||||
"""
|
"""
|
||||||
Main entry point for Rattail Tutorial command system
|
Main entry point for Rattail Tutorial command system
|
||||||
|
|
Loading…
Reference in a new issue