from datetime import date import argparse from argparse import Namespace from sme_logger.logger import Level def read_cli_args() -> Namespace: """Reads parameters from command line arguments Returns: Namespace """ parser = argparse.ArgumentParser() parser.add_argument('--src-bucket', type=str, help='Source bucket', required=True) parser.add_argument('--dst-bucket', type=str, help='Destination bucket', required=True) parser.add_argument('--dsp', type=str, choices=['apple', 'spotify'], help='DSP to migrate', required=True) parser.add_argument('--report-type', type=str, help='Report type (streams, users, tracks, etc.)') parser.add_argument('--licensor', type=str, help='Licensor') parser.add_argument('--start-date', type=str, help='Start date', required=True) parser.add_argument('--end-date', type=str, help='End date', default=str(date.today())) parser.add_argument('--log-level', type=Level, help='Logging level', default=Level.INFO) parser.add_argument('--with-size-validation', action='store_true', help='Enables size validation') parser.add_argument('--with-fingerprint-tagging', action='store_true', help='Enables fingerprint tagging for dst') parser.add_argument('--with-fingerprint-validation', action='store_true', help='Enables fingerprint validation') parser.add_argument('--no-copy', action='store_true', help='Do not copy data. This might be used for validation') parser.add_argument('--src-org', type=str, choices=['apollo', 'orchard'], default='apollo') parser.add_argument('--random-files-check', action='store_true') args = parser.parse_args() if args.random_files_check and not args.no_copy: parser.error('--random-files-check argument requires --no-copy') return args