Add typer equivalents for rattail
commands
This commit is contained in:
parent
6450623802
commit
cb62c1383c
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2024 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,10 +24,50 @@
|
|||
Rattail/WooCommerce 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 ExportWooCommerce(commands.ImportSubcommand):
|
||||
@rattail_typer.command()
|
||||
@importer_command
|
||||
def export_woocommerce(
|
||||
ctx: typer.Context,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Export data to WooCommerce
|
||||
"""
|
||||
config = ctx.parent.rattail_config
|
||||
progress = ctx.parent.rattail_progress
|
||||
handler = ImportCommandHandler(
|
||||
config,
|
||||
import_handler_spec='rattail_woocommerce.woocommerce.importing.rattail:FromRattailToWooCommerce')
|
||||
kwargs['user'] = typer_get_runas_user(ctx)
|
||||
handler.run(kwargs, progress=progress)
|
||||
|
||||
|
||||
@rattail_typer.command()
|
||||
@importer_command
|
||||
def import_woocommerce(
|
||||
ctx: typer.Context,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Import data from WooCommerce
|
||||
"""
|
||||
config = ctx.parent.rattail_config
|
||||
progress = ctx.parent.rattail_progress
|
||||
handler = ImportCommandHandler(
|
||||
config,
|
||||
import_handler_spec='rattail_woocommerce.importing.woocommerce:FromWooCommerceToRattail')
|
||||
kwargs['user'] = typer_get_runas_user(ctx)
|
||||
handler.run(kwargs, progress=progress)
|
||||
|
||||
|
||||
class ExportWooCommerce(ImportSubcommand):
|
||||
"""
|
||||
Export data to WooCommerce
|
||||
"""
|
||||
|
@ -36,7 +76,7 @@ class ExportWooCommerce(commands.ImportSubcommand):
|
|||
handler_spec = 'rattail_woocommerce.woocommerce.importing.rattail:FromRattailToWooCommerce'
|
||||
|
||||
|
||||
class ImportWooCommerce(commands.ImportSubcommand):
|
||||
class ImportWooCommerce(ImportSubcommand):
|
||||
"""
|
||||
Import data from WooCommerce
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue