mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Include optional args in the valid option processing.
Optional arguments were not being included in the valid list of options being checked so `--mail` resulted in being unknown.
This commit is contained in:
parent
079f95a91b
commit
d2d46786f1
@ -237,12 +237,13 @@ class command_line:
|
|||||||
raise error.exit()
|
raise error.exit()
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
|
for a in self.args:
|
||||||
|
if a == '-?' or a == '--help':
|
||||||
|
self.help()
|
||||||
arg = 0
|
arg = 0
|
||||||
while arg < len(self.args):
|
while arg < len(self.args):
|
||||||
a = self.args[arg]
|
a = self.args[arg]
|
||||||
if a == '-?':
|
if a.startswith('--'):
|
||||||
self.help()
|
|
||||||
elif a.startswith('--'):
|
|
||||||
los = a.split('=')
|
los = a.split('=')
|
||||||
lo = los[0]
|
lo = los[0]
|
||||||
if lo in self._long_opts:
|
if lo in self._long_opts:
|
||||||
@ -266,8 +267,11 @@ class command_line:
|
|||||||
value = '1'
|
value = '1'
|
||||||
self.defaults[los[0][2:].replace('-', '_').lower()] = ('none', 'none', value)
|
self.defaults[los[0][2:].replace('-', '_').lower()] = ('none', 'none', value)
|
||||||
else:
|
else:
|
||||||
raise error.general('unknown option: %s' % (lo))
|
if lo not in self.optargs:
|
||||||
|
raise error.general('unknown option: %s' % (lo))
|
||||||
else:
|
else:
|
||||||
|
if a.startswith('-'):
|
||||||
|
raise error.general('not short options; only "-?"')
|
||||||
self.opts['params'].append(a)
|
self.opts['params'].append(a)
|
||||||
arg += 1
|
arg += 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user