Add ‘only-generate’ parameter to generate command to only generate the C++ code (#84)

* Introduce parser_compile variable

* Add ‘only-generate’ parameter to the compile command which only generates the C++ code
This commit is contained in:
Adriaan Peeters 2018-09-19 14:51:39 +02:00 committed by Otto Winter
parent 1c7bddd005
commit 490743c26e
1 changed files with 7 additions and 1 deletions

View File

@ -300,6 +300,9 @@ def command_compile(args, config):
exit_code = write_cpp(config)
if exit_code != 0:
return exit_code
if args.only_generate:
_LOGGER.info(u"Successfully generated source code.")
return 0;
exit_code = compile_program(args, config)
if exit_code != 0:
return exit_code
@ -385,7 +388,10 @@ def parse_args(argv):
subparsers.required = True
subparsers.add_parser('config', help='Validate the configuration and spit it out.')
subparsers.add_parser('compile', help='Read the configuration and compile a program.')
parser_compile = subparsers.add_parser('compile', help='Read the configuration and compile a program.')
parser_compile.add_argument('--only-generate',
help="Only generate source code, do not compile.",
action='store_true')
parser_upload = subparsers.add_parser('upload', help='Validate the configuration '
'and upload the latest binary.')