From 490743c26e3226f95181d00ded522b3f41372cb4 Mon Sep 17 00:00:00 2001 From: Adriaan Peeters Date: Wed, 19 Sep 2018 14:51:39 +0200 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98only-generate=E2=80=99=20paramet?= =?UTF-8?q?er=20to=20generate=20command=20to=20only=20generate=20the=20C++?= =?UTF-8?q?=20code=20(#84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Introduce parser_compile variable * Add ‘only-generate’ parameter to the compile command which only generates the C++ code --- esphomeyaml/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/esphomeyaml/__main__.py b/esphomeyaml/__main__.py index c08d870f08..93719fcd5c 100644 --- a/esphomeyaml/__main__.py +++ b/esphomeyaml/__main__.py @@ -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.')