find.py 1.1 KB

1234567891011121314151617181920212223
  1. """Command to search through all keyboards and keymaps for a given search criteria.
  2. """
  3. from milc import cli
  4. from qmk.search import search_keymap_targets
  5. @cli.argument(
  6. '-f',
  7. '--filter',
  8. arg_only=True,
  9. action='append',
  10. default=[],
  11. help= # noqa: `format-python` and `pytest` don't agree here.
  12. "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.
  13. )
  14. @cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.")
  15. @cli.subcommand('Find builds which match supplied search criteria.')
  16. def find(cli):
  17. """Search through all keyboards and keymaps for a given search criteria.
  18. """
  19. targets = search_keymap_targets(cli.args.keymap, cli.args.filter)
  20. for target in targets:
  21. print(f'{target[0]}:{target[1]}')