[CLI] Add a subcommand for getting information about a keyboard (#8666)
You can now use `qmk info` to get information about keyboards and keymaps. Co-authored-by: Erovia <Erovia@users.noreply.github.com>
This commit is contained in:
parent
5d3bf8a050
commit
751316c344
17 changed files with 921 additions and 113 deletions
|
@ -5,7 +5,8 @@ from pathlib import Path
|
|||
|
||||
from milc import cli
|
||||
|
||||
from qmk.path import is_keyboard, is_keymap_dir, under_qmk_firmware
|
||||
from qmk.keymap import is_keymap_dir
|
||||
from qmk.path import is_keyboard, under_qmk_firmware
|
||||
|
||||
|
||||
def automagic_keyboard(func):
|
||||
|
@ -67,18 +68,18 @@ def automagic_keymap(func):
|
|||
while current_path.parent.name != 'keymaps':
|
||||
current_path = current_path.parent
|
||||
cli.config[cli._entrypoint.__name__]['keymap'] = current_path.name
|
||||
cli.config_source[cli._entrypoint.__name__]['keyboard'] = 'keymap_directory'
|
||||
cli.config_source[cli._entrypoint.__name__]['keymap'] = 'keymap_directory'
|
||||
|
||||
# If we're in `qmk_firmware/layouts` guess the name from the community keymap they're in
|
||||
elif relative_cwd.parts[0] == 'layouts' and is_keymap_dir(relative_cwd):
|
||||
cli.config[cli._entrypoint.__name__]['keymap'] = relative_cwd.name
|
||||
cli.config_source[cli._entrypoint.__name__]['keyboard'] = 'layouts_directory'
|
||||
cli.config_source[cli._entrypoint.__name__]['keymap'] = 'layouts_directory'
|
||||
|
||||
# If we're in `qmk_firmware/users` guess the name from the userspace they're in
|
||||
elif relative_cwd.parts[0] == 'users':
|
||||
# Guess the keymap name based on which userspace they're in
|
||||
cli.config[cli._entrypoint.__name__]['keymap'] = relative_cwd.parts[1]
|
||||
cli.config_source[cli._entrypoint.__name__]['keyboard'] = 'users_directory'
|
||||
cli.config_source[cli._entrypoint.__name__]['keymap'] = 'users_directory'
|
||||
|
||||
return func(*args, **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue