I have the following options
parser = OptionParser()
parser.add_option('-a', '--all', action='store_true', dest='all', help='writes all header information')
parser.add_option('-h', '--file-header', action='store_true', dest='head', help='prints the elf file header information')
parser.add_option('-l', '--program-header', action='store_true', dest='prog', help='prints the program header')
parser.add_option('-S', '--section-header', action='store_true', dest='sec', help='prints the section header')
When running the script I get the error message:
optparse.OptionConflictError: option -h/--file-header: conflicting option string(s): -h
I know normally -h is reserved to display the help. But I'm trying to write an ELF file reader for some special elf files, and therefore I want to use the same commands like readelf
. And readelf uses -h for printing the header information.
Is there any possibility to overwrite the -h option in the option parser or is that fixed?
答案 0 :(得分:8)
When creating the parser, pass add_help_option=False
. Then you will be able to define it by yourself:
parser = OptionParser(add_help_option=False)