mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-08-04 00:10:42 -04:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
@@ -57,7 +57,7 @@ def c2json(cli):
|
||||
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(json.dumps(keymap_json, cls=InfoJSONEncoder))
|
||||
cli.args.output.write_text(json.dumps(keymap_json, cls=InfoJSONEncoder, sort_keys=True))
|
||||
|
||||
if not cli.args.quiet:
|
||||
cli.log.info('Wrote keymap to %s.', cli.args.output)
|
||||
|
||||
@@ -11,13 +11,17 @@ from qmk.search import search_keymap_targets
|
||||
action='append',
|
||||
default=[],
|
||||
help= # noqa: `format-python` and `pytest` don't agree here.
|
||||
"Filter the list of keyboards based on the supplied value in rules.mk. Matches info.json structure, and accepts the formats 'features.rgblight=true' or 'exists(matrix_pins.direct)'. May be passed multiple times, all filters need to match. Value may include wildcards such as '*' and '?'." # noqa: `format-python` and `pytest` don't agree here.
|
||||
"Filter the list of keyboards based on their info.json data. Accepts the formats key=value, function(key), or function(key,value), eg. 'features.rgblight=true'. Valid functions are 'absent', 'contains', 'exists' and 'length'. May be passed multiple times; all filters need to match. Value may include wildcards such as '*' and '?'." # noqa: `format-python` and `pytest` don't agree here.
|
||||
)
|
||||
@cli.argument('-p', '--print', arg_only=True, action='append', default=[], help="For each matched target, print the value of the supplied info.json key. May be passed multiple times.")
|
||||
@cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.")
|
||||
@cli.subcommand('Find builds which match supplied search criteria.')
|
||||
def find(cli):
|
||||
"""Search through all keyboards and keymaps for a given search criteria.
|
||||
"""
|
||||
targets = search_keymap_targets(cli.args.keymap, cli.args.filter)
|
||||
for target in targets:
|
||||
print(f'{target[0]}:{target[1]}')
|
||||
targets = search_keymap_targets(cli.args.keymap, cli.args.filter, cli.args.print)
|
||||
for keyboard, keymap, print_vals in targets:
|
||||
print(f'{keyboard}:{keymap}')
|
||||
|
||||
for key, val in print_vals:
|
||||
print(f' {key}={val}')
|
||||
|
||||
@@ -62,4 +62,4 @@ def format_json(cli):
|
||||
json_file['layers'][layer_num] = current_layer
|
||||
|
||||
# Display the results
|
||||
print(json.dumps(json_file, cls=json_encoder))
|
||||
print(json.dumps(json_file, cls=json_encoder, sort_keys=True))
|
||||
|
||||
@@ -76,7 +76,7 @@ def generate_info_json(cli):
|
||||
# Build the info.json file
|
||||
kb_info_json = info_json(cli.config.generate_info_json.keyboard)
|
||||
strip_info_json(kb_info_json)
|
||||
info_json_text = json.dumps(kb_info_json, indent=4, cls=InfoJSONEncoder)
|
||||
info_json_text = json.dumps(kb_info_json, indent=4, cls=InfoJSONEncoder, sort_keys=True)
|
||||
|
||||
if cli.args.output:
|
||||
# Write to a file
|
||||
|
||||
@@ -200,7 +200,7 @@ def info(cli):
|
||||
|
||||
# Output in the requested format
|
||||
if cli.args.format == 'json':
|
||||
print(json.dumps(kb_info_json, cls=InfoJSONEncoder))
|
||||
print(json.dumps(kb_info_json, cls=InfoJSONEncoder, sort_keys=True))
|
||||
return True
|
||||
elif cli.args.format == 'text':
|
||||
print_dotted_output(kb_info_json)
|
||||
|
||||
@@ -75,7 +75,7 @@ def migrate(cli):
|
||||
|
||||
# Finally write out updated info.json
|
||||
cli.log.info(f' Updating {target_info}')
|
||||
target_info.write_text(json.dumps(info_data.to_dict(), cls=InfoJSONEncoder))
|
||||
target_info.write_text(json.dumps(info_data.to_dict(), cls=InfoJSONEncoder, sort_keys=True))
|
||||
|
||||
cli.log.info(f'{{fg_green}}Migration of keyboard {{fg_cyan}}{cli.args.keyboard}{{fg_green}} complete!{{fg_reset}}')
|
||||
cli.log.info(f"Verify build with {{fg_yellow}}qmk compile -kb {cli.args.keyboard} -km default{{fg_reset}}.")
|
||||
|
||||
@@ -102,7 +102,7 @@ def augment_community_info(src, dest):
|
||||
item["matrix"] = [int(item["y"]), int(item["x"])]
|
||||
|
||||
# finally write out the updated info.json
|
||||
dest.write_text(json.dumps(info, cls=InfoJSONEncoder))
|
||||
dest.write_text(json.dumps(info, cls=InfoJSONEncoder, sort_keys=True))
|
||||
|
||||
|
||||
def _question(*args, **kwargs):
|
||||
|
||||
@@ -141,5 +141,5 @@ def via2json(cli):
|
||||
# Generate the keymap.json
|
||||
keymap_json = generate_json(cli.args.keymap, cli.args.keyboard, keymap_layout, keymap_data, macro_data)
|
||||
|
||||
keymap_lines = [json.dumps(keymap_json, cls=KeymapJSONEncoder)]
|
||||
keymap_lines = [json.dumps(keymap_json, cls=KeymapJSONEncoder, sort_keys=True)]
|
||||
dump_lines(cli.args.output, keymap_lines, cli.args.quiet)
|
||||
|
||||
Reference in New Issue
Block a user