Add typer equivalents for rattail
commands
This commit is contained in:
parent
d7e840138b
commit
8784579e27
|
@ -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-harvest commands
|
rattail-harvest 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 ImportHarvest(commands.ImportSubcommand):
|
@rattail_typer.command()
|
||||||
|
@importer_command
|
||||||
|
def import_harvest(
|
||||||
|
ctx: typer.Context,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Import data to Rattail, from Harvest API
|
||||||
|
"""
|
||||||
|
config = ctx.parent.rattail_config
|
||||||
|
progress = ctx.parent.rattail_progress
|
||||||
|
handler = ImportCommandHandler(
|
||||||
|
config, import_handler_key='to_rattail.from_harvest.import')
|
||||||
|
kwargs['user'] = typer_get_runas_user(ctx)
|
||||||
|
handler.run(kwargs, progress=progress)
|
||||||
|
|
||||||
|
|
||||||
|
class ImportHarvest(ImportSubcommand):
|
||||||
"""
|
"""
|
||||||
Import data to Rattail, from Harvest API
|
Import data to Rattail, from Harvest API
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -35,6 +35,9 @@ include_package_data = True
|
||||||
rattail.subcommands =
|
rattail.subcommands =
|
||||||
import-harvest = rattail_harvest.commands:ImportHarvest
|
import-harvest = rattail_harvest.commands:ImportHarvest
|
||||||
|
|
||||||
|
rattail.typer_imports =
|
||||||
|
rattail_harvest = rattail_harvest.commands
|
||||||
|
|
||||||
rattail.config.extensions =
|
rattail.config.extensions =
|
||||||
rattail_harvest = rattail_harvest.config:RattailHarvestExtension
|
rattail_harvest = rattail_harvest.config:RattailHarvestExtension
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue