diff options
Diffstat (limited to 'lib/python/qmk/cli/generate/config_h.py')
-rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index 24bbbdf517..fdc76b23d4 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -9,7 +9,9 @@ from qmk.info import info_json from qmk.json_schema import json_load, validate from qmk.keyboard import keyboard_completer, keyboard_folder from qmk.keymap import locate_keymap +from qmk.commands import dump_lines from qmk.path import normpath +from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE def direct_pins(direct_pins, postfix): @@ -181,7 +183,7 @@ def generate_config_h(cli): kb_info_json = dotty(info_json(cli.args.keyboard)) # Build the info_config.h file. - config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.', ' */', '', '#pragma once'] + config_h_lines = [GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE, '#pragma once'] generate_config_items(kb_info_json, config_h_lines) @@ -194,16 +196,4 @@ def generate_config_h(cli): generate_split_config(kb_info_json, config_h_lines) # Show the results - config_h = '\n'.join(config_h_lines) - - if cli.args.output: - cli.args.output.parent.mkdir(parents=True, exist_ok=True) - if cli.args.output.exists(): - cli.args.output.replace(cli.args.output.parent / (cli.args.output.name + '.bak')) - cli.args.output.write_text(config_h) - - if not cli.args.quiet: - cli.log.info('Wrote info_config.h to %s.', cli.args.output) - - else: - print(config_h) + dump_lines(cli.args.output, config_h_lines, cli.args.quiet) |