from __future__ import annotations


def register(subparsers) -> None:
    import_parser = subparsers.add_parser("import", help="导入客户文件")
    import_subparsers = import_parser.add_subparsers(dest="import_action", required=True)

    file_parser = import_subparsers.add_parser("file", help="导入文件")
    file_parser.add_argument("--path", required=True)
    file_parser.add_argument("--commit", action="store_true")
    file_parser.set_defaults(handler=handle_import_file)


def handle_import_file(args, service):
    return service.import_file(args.path, commit=args.commit)
