2019-10-08 21:50:21 +02:00
|
|
|
"""List the keymaps for a specific keyboard
|
|
|
|
"""
|
|
|
|
from milc import cli
|
2019-10-13 19:07:22 +02:00
|
|
|
import qmk.keymap
|
|
|
|
from qmk.errors import NoSuchKeyboardError
|
2019-10-09 10:14:53 +02:00
|
|
|
|
2019-10-09 20:53:18 +02:00
|
|
|
@cli.argument("-kb", "--keyboard", help="Specify keyboard name. Example: 1upkeyboards/1up60hse")
|
2019-10-08 21:50:21 +02:00
|
|
|
@cli.subcommand("List the keymaps for a specific keyboard")
|
|
|
|
def list_keymaps(cli):
|
|
|
|
"""List the keymaps for a specific keyboard
|
|
|
|
"""
|
|
|
|
# ask for user input if keyboard was not provided in the command line
|
2019-10-10 22:58:52 +02:00
|
|
|
keyboard_name = cli.config.list_keymaps.keyboard if cli.config.list_keymaps.keyboard else input("Keyboard Name: ")
|
2019-10-08 21:50:21 +02:00
|
|
|
|
2019-10-13 19:07:22 +02:00
|
|
|
try:
|
|
|
|
for name in qmk.keymap.list_keymaps(keyboard_name):
|
|
|
|
# We echo instead of cli.log.info to allow easier piping of this output
|
|
|
|
cli.echo(keyboard_name + ":" + name)
|
|
|
|
except NoSuchKeyboardError as e:
|
|
|
|
cli.echo("{fg_red}" + e.message)
|