1
0
Fork 0

[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:
Zach White 2020-05-26 13:05:41 -07:00 committed by GitHub
parent 5d3bf8a050
commit 751316c344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 921 additions and 113 deletions

View file

@ -4,20 +4,10 @@ import logging
import os
from pathlib import Path
from qmk.constants import QMK_FIRMWARE, MAX_KEYBOARD_SUBFOLDERS
from qmk.constants import MAX_KEYBOARD_SUBFOLDERS, QMK_FIRMWARE
from qmk.errors import NoSuchKeyboardError
def is_keymap_dir(keymap_path):
"""Returns True if `keymap_path` is a valid keymap directory.
"""
keymap_path = Path(keymap_path)
keymap_c = keymap_path / 'keymap.c'
keymap_json = keymap_path / 'keymap.json'
return any((keymap_c.exists(), keymap_json.exists()))
def is_keyboard(keyboard_name):
"""Returns True if `keyboard_name` is a keyboard we can compile.
"""
@ -68,17 +58,3 @@ def normpath(path):
return path
return Path(os.environ['ORIG_CWD']) / path
def c_source_files(dir_names):
"""Returns a list of all *.c, *.h, and *.cpp files for a given list of directories
Args:
dir_names
List of directories, relative pathing starts at qmk's cwd
"""
files = []
for dir in dir_names:
files.extend(file for file in Path(dir).glob('**/*') if file.suffix in ['.c', '.h', '.cpp'])
return files