qconfig: Move arg parsing into a separate function
Reduce the size of main() by putting this code into its own function. For now the parser object needs to be returned too. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -1453,8 +1453,14 @@ def do_scan_source(path, do_update):
|
|||||||
print(item, file=out)
|
print(item, file=out)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def parse_args():
|
||||||
"""Main program"""
|
"""Parse the program arguments
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple:
|
||||||
|
argparse.ArgumentParser: parser
|
||||||
|
argparse.Namespace: Parsed arguments
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
cpu_count = multiprocessing.cpu_count()
|
cpu_count = multiprocessing.cpu_count()
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
@@ -1512,8 +1518,12 @@ doc/develop/moveconfig.rst for documentation.'''
|
|||||||
help='show any build errors as boards are built')
|
help='show any build errors as boards are built')
|
||||||
parser.add_argument('configs', nargs='*')
|
parser.add_argument('configs', nargs='*')
|
||||||
|
|
||||||
args = parser.parse_args()
|
return parser, parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main program"""
|
||||||
|
parser, args = parse_args()
|
||||||
if args.test:
|
if args.test:
|
||||||
sys.argv = [sys.argv[0]]
|
sys.argv = [sys.argv[0]]
|
||||||
fail, _ = doctest.testmod()
|
fail, _ = doctest.testmod()
|
||||||
|
Reference in New Issue
Block a user