[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
|
@ -4,7 +4,9 @@ import subprocess
|
|||
from shutil import which
|
||||
|
||||
from milc import cli
|
||||
import qmk.path
|
||||
|
||||
from qmk.path import normpath
|
||||
from qmk.c_parse import c_source_files
|
||||
|
||||
|
||||
def cformat_run(files, all_files):
|
||||
|
@ -45,10 +47,10 @@ def cformat(cli):
|
|||
ignores = ['tmk_core/protocol/usb_hid', 'quantum/template']
|
||||
# Find the list of files to format
|
||||
if cli.args.files:
|
||||
files.extend(qmk.path.normpath(file) for file in cli.args.files)
|
||||
files.extend(normpath(file) for file in cli.args.files)
|
||||
# If -a is specified
|
||||
elif cli.args.all_files:
|
||||
all_files = qmk.path.c_source_files(core_dirs)
|
||||
all_files = c_source_files(core_dirs)
|
||||
# The following statement checks each file to see if the file path is in the ignored directories.
|
||||
files.extend(file for file in all_files if not any(i in str(file) for i in ignores))
|
||||
# No files specified & no -a flag
|
||||
|
@ -56,7 +58,7 @@ def cformat(cli):
|
|||
base_args = ['git', 'diff', '--name-only', cli.args.base_branch]
|
||||
out = subprocess.run(base_args + core_dirs, check=True, stdout=subprocess.PIPE)
|
||||
changed_files = filter(None, out.stdout.decode('UTF-8').split('\n'))
|
||||
filtered_files = [qmk.path.normpath(file) for file in changed_files if not any(i in file for i in ignores)]
|
||||
filtered_files = [normpath(file) for file in changed_files if not any(i in file for i in ignores)]
|
||||
files.extend(file for file in filtered_files if file.exists() and file.suffix in ['.c', '.h', '.cpp'])
|
||||
|
||||
# Run clang-format on the files we've found
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue