keymaps.py 841 B

1234567891011121314151617181920
  1. """List the keymaps for a specific keyboard
  2. """
  3. from milc import cli
  4. import qmk.keymap
  5. from qmk.errors import NoSuchKeyboardError
  6. @cli.argument("-kb", "--keyboard", help="Specify keyboard name. Example: 1upkeyboards/1up60hse")
  7. @cli.subcommand("List the keymaps for a specific keyboard")
  8. def list_keymaps(cli):
  9. """List the keymaps for a specific keyboard
  10. """
  11. # ask for user input if keyboard was not provided in the command line
  12. keyboard_name = cli.config.list_keymaps.keyboard if cli.config.list_keymaps.keyboard else input("Keyboard Name: ")
  13. try:
  14. for name in qmk.keymap.list_keymaps(keyboard_name):
  15. # We echo instead of cli.log.info to allow easier piping of this output
  16. cli.echo(keyboard_name + ":" + name)
  17. except NoSuchKeyboardError as e:
  18. cli.echo("{fg_red}" + e.message)