Add core-office export-csv command; deprecate crepes export-csv

This commit is contained in:
Lance Edgar 2023-06-11 11:55:29 -05:00
parent 77bd9e34e4
commit 15bac1dc23
3 changed files with 19 additions and 9 deletions

View file

@ -29,7 +29,7 @@ import warnings
from rattail import commands from rattail import commands
from rattail_corepos import __version__ from rattail_corepos import __version__
from rattail_corepos.corepos.office.commands import ImportCSV from rattail_corepos.corepos.office.commands import ExportCSV, ImportCSV
def main(*args): def main(*args):
@ -83,13 +83,13 @@ class ExportCore(commands.ImportSubcommand):
return kwargs return kwargs
class ExportCSV(commands.ExportFileSubcommand): class LegacyExportCSV(ExportCSV):
"""
Export data from CORE to CSV file(s) def __init__(self, *args, **kwargs):
""" warnings.warn("the `crepes export-csv` command is deprecated; "
name = 'export-csv' "please use `core-office export-csv` instead",
description = __doc__.strip() DeprecationWarning, stacklevel=2)
handler_key = 'to_csv.from_corepos_db_office_op.export' super().__init__(*args, **kwargs)
class ImportCore(ImportToCore): class ImportCore(ImportToCore):

View file

@ -100,6 +100,15 @@ class GetConfigValue(commands.Subcommand):
self.stdout.write(f"{value}\n") self.stdout.write(f"{value}\n")
class ExportCSV(commands.ExportFileSubcommand):
"""
Export data from CORE to CSV file(s)
"""
name = 'export-csv'
description = __doc__.strip()
handler_key = 'to_csv.from_corepos_db_office_op.export'
class ImportCSV(commands.ImportFileSubcommand): class ImportCSV(commands.ImportFileSubcommand):
""" """
Import data from CSV to CORE Office "op" DB Import data from CSV to CORE Office "op" DB

View file

@ -41,6 +41,7 @@ console_scripts =
core-office = rattail_corepos.corepos.office.commands:main core-office = rattail_corepos.corepos.office.commands:main
core_office.commands = core_office.commands =
export-csv = rattail_corepos.corepos.office.commands:ExportCSV
export-lane-op = rattail_corepos.corepos.office.commands:ExportLaneOp export-lane-op = rattail_corepos.corepos.office.commands:ExportLaneOp
import-csv = rattail_corepos.corepos.office.commands:ImportCSV import-csv = rattail_corepos.corepos.office.commands:ImportCSV
import-self = rattail_corepos.corepos.office.commands:ImportSelf import-self = rattail_corepos.corepos.office.commands:ImportSelf
@ -49,7 +50,7 @@ core_office.commands =
crepes.commands = crepes.commands =
export-core = rattail_corepos.corepos.commands:ExportCore export-core = rattail_corepos.corepos.commands:ExportCore
export-csv = rattail_corepos.corepos.commands:ExportCSV export-csv = rattail_corepos.corepos.commands:LegacyExportCSV
import-core = rattail_corepos.corepos.commands:ImportCore import-core = rattail_corepos.corepos.commands:ImportCore
import-csv = rattail_corepos.corepos.commands:LegacyImportCSV import-csv = rattail_corepos.corepos.commands:LegacyImportCSV