[8/N] enable cli flag without a space (#10529)
Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
@@ -882,7 +882,10 @@ class EngineArgs:
|
||||
'testing only. level 3 is the recommended level '
|
||||
'for production.\n'
|
||||
'To specify the full compilation config, '
|
||||
'use a JSON string.')
|
||||
'use a JSON string.\n'
|
||||
'Following the convention of traditional '
|
||||
'compilers, using -O without space is also '
|
||||
'supported. -O3 is equivalent to -O 3.')
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@@ -1192,6 +1192,10 @@ class FlexibleArgumentParser(argparse.ArgumentParser):
|
||||
else:
|
||||
processed_args.append('--' +
|
||||
arg[len('--'):].replace('_', '-'))
|
||||
elif arg.startswith('-O') and arg != '-O' and len(arg) == 2:
|
||||
# allow -O flag to be used without space, e.g. -O3
|
||||
processed_args.append('-O')
|
||||
processed_args.append(arg[2:])
|
||||
else:
|
||||
processed_args.append(arg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user