Add auto_int for range args
This commit is contained in:
parent
87c68c1a0a
commit
f349efff80
1 changed files with 11 additions and 4 deletions
|
@ -3,6 +3,11 @@ import argparse
|
||||||
from tw88xx import TW88xx
|
from tw88xx import TW88xx
|
||||||
parser = argparse.ArgumentParser(description='TW88xx debug utility.')
|
parser = argparse.ArgumentParser(description='TW88xx debug utility.')
|
||||||
|
|
||||||
|
|
||||||
|
def auto_int(x):
|
||||||
|
return int(x, 0)
|
||||||
|
|
||||||
|
|
||||||
parser.add_argument('command',
|
parser.add_argument('command',
|
||||||
help='the command to execute',
|
help='the command to execute',
|
||||||
choices=('dump_flash', 'get_id', 'dump_regs', 'dump_lut')
|
choices=('dump_flash', 'get_id', 'dump_regs', 'dump_lut')
|
||||||
|
@ -30,11 +35,13 @@ parser.add_argument('-t', '--type',
|
||||||
)
|
)
|
||||||
parser.add_argument('--start',
|
parser.add_argument('--start',
|
||||||
help='begin of reading range',
|
help='begin of reading range',
|
||||||
default='0'
|
type=auto_int,
|
||||||
|
default=0
|
||||||
)
|
)
|
||||||
parser.add_argument('--length',
|
parser.add_argument('--length',
|
||||||
help='amount to read',
|
help='amount to read',
|
||||||
default='0'
|
type=auto_int,
|
||||||
|
default=0
|
||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
Loading…
Reference in a new issue