mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	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:
		
				
					committed by
					
						 Otto Winter
						Otto Winter
					
				
			
			
				
	
			
			
			
						parent
						
							1c7bddd005
						
					
				
				
					commit
					490743c26e
				
			| @@ -300,6 +300,9 @@ def command_compile(args, config): | |||||||
|     exit_code = write_cpp(config) |     exit_code = write_cpp(config) | ||||||
|     if exit_code != 0: |     if exit_code != 0: | ||||||
|         return exit_code |         return exit_code | ||||||
|  |     if args.only_generate: | ||||||
|  |         _LOGGER.info(u"Successfully generated source code.") | ||||||
|  |         return 0; | ||||||
|     exit_code = compile_program(args, config) |     exit_code = compile_program(args, config) | ||||||
|     if exit_code != 0: |     if exit_code != 0: | ||||||
|         return exit_code |         return exit_code | ||||||
| @@ -385,7 +388,10 @@ def parse_args(argv): | |||||||
|     subparsers.required = True |     subparsers.required = True | ||||||
|     subparsers.add_parser('config', help='Validate the configuration and spit it out.') |     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 ' |     parser_upload = subparsers.add_parser('upload', help='Validate the configuration ' | ||||||
|                                                          'and upload the latest binary.') |                                                          'and upload the latest binary.') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user