From 189a21409da4ea8407ca1262fa77acf55d35b36a Mon Sep 17 00:00:00 2001
From: Adriaan Peeters <apeeters@lashout.net>
Date: Sun, 26 Aug 2018 12:33:31 +0200
Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98only-generate=E2=80=99=20paramet?=
 =?UTF-8?q?er=20to=20the=20compile=20command=20which=20only=20generates=20?=
 =?UTF-8?q?the=20C++=20code?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 esphomeyaml/__main__.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/esphomeyaml/__main__.py b/esphomeyaml/__main__.py
index ec608b3e6d..a1459bd93d 100644
--- a/esphomeyaml/__main__.py
+++ b/esphomeyaml/__main__.py
@@ -295,6 +295,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
@@ -381,6 +384,9 @@ def parse_args(argv):
     subparsers.add_parser('config', help='Validate the configuration and spit it out.')
 
     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.')