Add qmk find
command, reuse logic for qmk mass-compile
. (#20139)
This commit is contained in:
parent
f3f634ef67
commit
1b3f7fcf7d
5 changed files with 161 additions and 96 deletions
23
lib/python/qmk/cli/find.py
Normal file
23
lib/python/qmk/cli/find.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
"""Command to search through all keyboards and keymaps for a given search criteria.
|
||||
"""
|
||||
from milc import cli
|
||||
from qmk.search import search_keymap_targets
|
||||
|
||||
|
||||
@cli.argument(
|
||||
'-f',
|
||||
'--filter',
|
||||
arg_only=True,
|
||||
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.
|
||||
)
|
||||
@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]}')
|
Loading…
Add table
Add a link
Reference in a new issue