diff --git a/pyproject.toml b/pyproject.toml index a0b25d5..1926082 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,13 +48,6 @@ core-office = "rattail_corepos.corepos.office.commands:core_office_typer" rattail-corepos = "rattail_corepos.config:RattailCOREPOSExtension" -[project.entry-points."rattail.subcommands"] -export-corepos = "rattail_corepos.commands:ExportCore" -corepos-import-square = "rattail_corepos.commands:CoreImportSquare" -import-corepos-api = "rattail_corepos.commands:ImportCOREPOSAPI" -import-corepos-db = "rattail_corepos.commands:ImportCOREPOSDB" - - [project.entry-points."rattail.typer_imports"] rattail_corepos = "rattail_corepos.commands" diff --git a/rattail_corepos/commands.py b/rattail_corepos/commands.py index c8b0815..3dc177a 100644 --- a/rattail_corepos/commands.py +++ b/rattail_corepos/commands.py @@ -31,8 +31,7 @@ from corepos.enum import CoreDbType from rattail.commands import rattail_typer from rattail.commands.typer import importer_command, file_importer_command, typer_get_runas_user -from rattail.commands.importing import (ImportSubcommand, ImportFileSubcommand, - ImportCommandHandler) +from rattail.commands.importing import ImportCommandHandler @rattail_typer.command() @@ -116,60 +115,3 @@ def import_corepos_db( 'corepos_dbkey': corepos_dbkey, } handler.run(kwargs, progress=progress) - - -class ExportCore(ImportSubcommand): - """ - Export data from Rattail to CORE-POS - """ - name = 'export-corepos' - description = __doc__.strip() - handler_key = 'to_corepos_api.from_rattail.export' - - -class ImportCOREPOSAPI(ImportSubcommand): - """ - Import data from a CORE POS API - """ - name = 'import-corepos-api' - description = __doc__.strip() - handler_key = 'to_rattail.from_corepos_api.import' - - -class ImportCOREPOSDB(ImportSubcommand): - """ - Import data from a CORE POS database - """ - name = 'import-corepos-db' - description = __doc__.strip() - handler_key = 'to_rattail.from_corepos_db_office_op.import' - - def add_parser_args(self, parser): - super().add_parser_args(parser) - - parser.add_argument('--corepos-dbtype', metavar='TYPE', default='office_op', - choices=['office_op', 'office_trans'], - help="Config *type* for CORE-POS database engine to be used as " - "host. Default type is 'office_op' - this determines which " - "config section is used with regard to the --corepos-dbkey arg.") - - parser.add_argument('--corepos-dbkey', metavar='KEY', default='default', - help="Config key for CORE POS database engine to be used as the \"host\", " - "i.e. the source of the data to be imported. This key " "must be " - "defined in the [rattail_corepos.db] section of your config file. " - "Defaults to 'default'.") - - def get_handler_kwargs(self, **kwargs): - if 'args' in kwargs: - kwargs['corepos_dbtype'] = kwargs['args'].corepos_dbtype - kwargs['corepos_dbkey'] = kwargs['args'].corepos_dbkey - return kwargs - - -class CoreImportSquare(ImportFileSubcommand): - """ - Import transaction data from Square into CORE - """ - name = 'corepos-import-square' - description = __doc__.strip() - handler_key = 'to_corepos_db_office_trans.from_square_csv.import'