【发布时间】:2016-02-13 16:08:19
【问题描述】:
我有以下选择
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')
运行脚本时,我收到错误消息:
optparse.OptionConflictError: option -h/--file-header: conflicting option string(s): -h
我知道通常 -h 保留用于显示帮助。但我正在尝试为一些特殊的 elf 文件编写一个 ELF 文件阅读器,因此我想使用相同的命令,如readelf。 readelf 使用 -h 打印标题信息。
是否有可能覆盖选项解析器中的 -h 选项或者是否已修复?
【问题讨论】: