mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-11-04 07:12:33 +01:00 
			
		
		
		
	Make generating keymap.c from JSON more reliable
This commit is contained in:
		
							parent
							
								
									79edb7c594
								
							
						
					
					
						commit
						00fb1bd1f0
					
				@ -22,6 +22,5 @@ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
 | 
				
			|||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generate the keymap.c
 | 
					# Generate the keymap.c
 | 
				
			||||||
ifneq ("$(KEYMAP_JSON)","")
 | 
					$(KEYBOARD_OUTPUT)/src/keymap.c:
 | 
				
			||||||
    _ = $(shell test -e $(KEYMAP_C) || bin/qmk json-keymap $(KEYMAP_JSON) -o $(KEYMAP_C))
 | 
						bin/qmk json-keymap --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,7 @@ import qmk.keymap
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@cli.argument('-o', '--output', arg_only=True, help='File to write to')
 | 
					@cli.argument('-o', '--output', arg_only=True, help='File to write to')
 | 
				
			||||||
 | 
					@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
 | 
				
			||||||
@cli.argument('filename', arg_only=True, help='Configurator JSON file')
 | 
					@cli.argument('filename', arg_only=True, help='Configurator JSON file')
 | 
				
			||||||
@cli.subcommand('Creates a keymap.c from a QMK Configurator export.')
 | 
					@cli.subcommand('Creates a keymap.c from a QMK Configurator export.')
 | 
				
			||||||
def json_keymap(cli):
 | 
					def json_keymap(cli):
 | 
				
			||||||
@ -48,7 +49,8 @@ def json_keymap(cli):
 | 
				
			|||||||
        with open(output_file, 'w') as keymap_fd:
 | 
					        with open(output_file, 'w') as keymap_fd:
 | 
				
			||||||
            keymap_fd.write(keymap_c)
 | 
					            keymap_fd.write(keymap_c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cli.log.info('Wrote keymap to %s.', cli.args.output)
 | 
					        if not cli.args.quiet:
 | 
				
			||||||
 | 
					            cli.log.info('Wrote keymap to %s.', cli.args.output)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        print(keymap_c)
 | 
					        print(keymap_c)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user