Migrate the trainwreck
commands to use typer
This commit is contained in:
parent
76b183676d
commit
98e8e8128d
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2024 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -21,16 +21,28 @@
|
|||
#
|
||||
################################################################################
|
||||
"""
|
||||
Rattail Commands
|
||||
Trainwreck Commands
|
||||
"""
|
||||
|
||||
from rattail import commands
|
||||
import typer
|
||||
|
||||
from rattail.trainwreck.commands import trainwreck_typer
|
||||
from rattail.commands.typer import importer_command, typer_get_runas_user
|
||||
from rattail.commands.importing import ImportCommandHandler
|
||||
|
||||
|
||||
class ImportCore(commands.ImportSubcommand):
|
||||
@trainwreck_typer.command()
|
||||
@importer_command
|
||||
def import_corepos(
|
||||
ctx: typer.Context,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Import data from CORE-POS "trans" DB
|
||||
"""
|
||||
name = 'import-corepos'
|
||||
description = __doc__.strip()
|
||||
handler_key = 'to_trainwreck.from_corepos_db_office_trans.import'
|
||||
config = ctx.parent.rattail_config
|
||||
progress = ctx.parent.rattail_progress
|
||||
handler = ImportCommandHandler(
|
||||
config, import_handler_key='to_trainwreck.from_corepos_db_office_trans.import')
|
||||
kwargs['user'] = typer_get_runas_user(ctx)
|
||||
handler.run(kwargs, progress=progress)
|
||||
|
|
Loading…
Reference in a new issue