Fix up qmk find when not specifying filters. (#21059)

This commit is contained in:
Nick Brassel 2023-05-27 13:23:07 +10:00 committed by GitHub
parent 363bfdbfda
commit 5642bd1807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,10 @@ from qmk.search import search_keymap_targets
def find(cli): def find(cli):
"""Search through all keyboards and keymaps for a given search criteria. """Search through all keyboards and keymaps for a given search criteria.
""" """
if len(cli.args.filter) == 0 and len(cli.args.print) > 0:
cli.log.warning('No filters supplied -- keymaps not parsed, unable to print requested values.')
targets = search_keymap_targets(cli.args.keymap, cli.args.filter, cli.args.print) targets = search_keymap_targets(cli.args.keymap, cli.args.filter, cli.args.print)
for keyboard, keymap, print_vals in targets: for keyboard, keymap, print_vals in targets:
print(f'{keyboard}:{keymap}') print(f'{keyboard}:{keymap}')

View File

@ -61,7 +61,7 @@ def search_keymap_targets(keymap='default', filters=[], print_vals=[]):
target_list = [(kb, keymap) for kb in filter(lambda kb: kb is not None, pool.starmap(_keymap_exists, [(kb, keymap) for kb in qmk.keyboard.list_keyboards()]))] target_list = [(kb, keymap) for kb in filter(lambda kb: kb is not None, pool.starmap(_keymap_exists, [(kb, keymap) for kb in qmk.keyboard.list_keyboards()]))]
if len(filters) == 0: if len(filters) == 0:
targets = target_list targets = [(kb, km, {}) for kb, km in target_list]
else: else:
cli.log.info('Parsing data for all matching keyboard/keymap combinations...') cli.log.info('Parsing data for all matching keyboard/keymap combinations...')
valid_keymaps = [(e[0], e[1], dotty(e[2])) for e in pool.starmap(_load_keymap_info, target_list)] valid_keymaps = [(e[0], e[1], dotty(e[2])) for e in pool.starmap(_load_keymap_info, target_list)]