import argparse


class MyArgumentParser(argparse.ArgumentParser):
    def error(self, message):
        # Custom error message
        print(f"{message}")
        self.print_usage()  # Optionally print the help message
        exit(1)  # Optionally set a specific exit code

    def print_help(self, file=None):
        self.print_usage()

    def print_usage(self):
        print('usage: em_migrate_tz [-map] [-generate -mapping_file  <MAPPING_FILE>] [-verbose] [-h,--help]\n')
        print('optional arguments:')
        print('   -h, --help                              Show this help message and exit.')
        print('   -map                                    Map the TimeZone codes used in Jobs definitions to Iana Time Zone IDs.')
        print('   -generate                               Generate timezone mapping files .')
        print('   -mapping_file <MAPPING_FILE>            Path to the timezone mapping file.(MUST appear after -generate).')
        print('   -verbose                                Add detailed information.')
