Add typer equivalents for rattail
commands
This commit is contained in:
parent
6612c33b9e
commit
b04816b1ef
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
# Copyright © 2010-2024 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,10 +24,31 @@
|
|||
rattail-nationbuilder commands
|
||||
"""
|
||||
|
||||
from rattail import commands
|
||||
import typer
|
||||
|
||||
from rattail.commands import rattail_typer, ImportSubcommand
|
||||
from rattail.commands.typer import importer_command, typer_get_runas_user
|
||||
from rattail.commands.importing import ImportCommandHandler
|
||||
|
||||
|
||||
class ImportNationBuilder(commands.ImportSubcommand):
|
||||
@rattail_typer.command()
|
||||
@importer_command
|
||||
def import_nationbuilder(
|
||||
ctx: typer.Context,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Import data for NationBuilder => Rattail
|
||||
"""
|
||||
config = ctx.parent.rattail_config
|
||||
progress = ctx.parent.rattail_progress
|
||||
handler = ImportCommandHandler(
|
||||
config, import_handler_key='to_rattail.from_nationbuilder.import')
|
||||
kwargs['user'] = typer_get_runas_user(ctx)
|
||||
handler.run(kwargs, progress=progress)
|
||||
|
||||
|
||||
class ImportNationBuilder(ImportSubcommand):
|
||||
"""
|
||||
Import data for NationBuilder => Rattail
|
||||
"""
|
||||
|
|
|
@ -34,6 +34,9 @@ include_package_data = True
|
|||
rattail.subcommands =
|
||||
import-nationbuilder = rattail_nationbuilder.commands:ImportNationBuilder
|
||||
|
||||
rattail.typer_imports =
|
||||
rattail_nationbuilder = rattail_nationbuilder.commands
|
||||
|
||||
rattail.config.extensions =
|
||||
rattail_nationbuilder = rattail_nationbuilder.config:RattailNationBuilderExtension
|
||||
|
||||
|
|
Loading…
Reference in a new issue