Add typer equivalents for rattail
commands
This commit is contained in:
parent
378958c11d
commit
f0bcef4959
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2022 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,10 +24,31 @@
|
||||||
rattail-wave commands
|
rattail-wave 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 ImportWave(commands.ImportSubcommand):
|
@rattail_typer.command()
|
||||||
|
@importer_command
|
||||||
|
def import_wave(
|
||||||
|
ctx: typer.Context,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Import data to Rattail, from Wave API
|
||||||
|
"""
|
||||||
|
config = ctx.parent.rattail_config
|
||||||
|
progress = ctx.parent.rattail_progress
|
||||||
|
handler = ImportCommandHandler(
|
||||||
|
config, import_handler_key='to_rattail.from_wave.import')
|
||||||
|
kwargs['user'] = typer_get_runas_user(ctx)
|
||||||
|
handler.run(kwargs, progress=progress)
|
||||||
|
|
||||||
|
|
||||||
|
class ImportWave(ImportSubcommand):
|
||||||
"""
|
"""
|
||||||
Import data to Rattail, from Wave API
|
Import data to Rattail, from Wave API
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -35,6 +35,9 @@ include_package_data = True
|
||||||
rattail.subcommands =
|
rattail.subcommands =
|
||||||
import-wave = rattail_wave.commands:ImportWave
|
import-wave = rattail_wave.commands:ImportWave
|
||||||
|
|
||||||
|
rattail.typer_imports =
|
||||||
|
rattail_wave = rattail_wave.commands
|
||||||
|
|
||||||
rattail.config.extensions =
|
rattail.config.extensions =
|
||||||
rattail_wave = rattail_wave.config:RattailWaveExtension
|
rattail_wave = rattail_wave.config:RattailWaveExtension
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue