diff options
author | Zach White <skullydazed@users.noreply.github.com> | 2020-05-26 13:05:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 13:05:41 -0700 |
commit | 751316c34465ea77e066c3052729b207f3d62e0c (patch) | |
tree | cb99656b93c156757e2fd7c84fe716f9c300ca89 /lib/python/qmk/cli/cformat.py | |
parent | 5d3bf8a050f3c0beb1f91147dc1ab54de36cbb05 (diff) | |
download | qmk_firmware-751316c34465ea77e066c3052729b207f3d62e0c.tar.gz qmk_firmware-751316c34465ea77e066c3052729b207f3d62e0c.zip |
[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>
Diffstat (limited to 'lib/python/qmk/cli/cformat.py')
-rw-r--r-- | lib/python/qmk/cli/cformat.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/cformat.py b/lib/python/qmk/cli/cformat.py index 0cd8b6192..600161c5c 100644 --- a/lib/python/qmk/cli/cformat.py +++ b/lib/python/qmk/cli/cformat.py | |||
@@ -4,7 +4,9 @@ import subprocess | |||
4 | from shutil import which | 4 | from shutil import which |
5 | 5 | ||
6 | from milc import cli | 6 | from milc import cli |
7 | import qmk.path | 7 | |
8 | from qmk.path import normpath | ||
9 | from qmk.c_parse import c_source_files | ||
8 | 10 | ||
9 | 11 | ||
10 | def cformat_run(files, all_files): | 12 | def cformat_run(files, all_files): |
@@ -45,10 +47,10 @@ def cformat(cli): | |||
45 | ignores = ['tmk_core/protocol/usb_hid', 'quantum/template'] | 47 | ignores = ['tmk_core/protocol/usb_hid', 'quantum/template'] |
46 | # Find the list of files to format | 48 | # Find the list of files to format |
47 | if cli.args.files: | 49 | if cli.args.files: |
48 | files.extend(qmk.path.normpath(file) for file in cli.args.files) | 50 | files.extend(normpath(file) for file in cli.args.files) |
49 | # If -a is specified | 51 | # If -a is specified |
50 | elif cli.args.all_files: | 52 | elif cli.args.all_files: |
51 | all_files = qmk.path.c_source_files(core_dirs) | 53 | all_files = c_source_files(core_dirs) |
52 | # The following statement checks each file to see if the file path is in the ignored directories. | 54 | # The following statement checks each file to see if the file path is in the ignored directories. |
53 | files.extend(file for file in all_files if not any(i in str(file) for i in ignores)) | 55 | files.extend(file for file in all_files if not any(i in str(file) for i in ignores)) |
54 | # No files specified & no -a flag | 56 | # No files specified & no -a flag |
@@ -56,7 +58,7 @@ def cformat(cli): | |||
56 | base_args = ['git', 'diff', '--name-only', cli.args.base_branch] | 58 | base_args = ['git', 'diff', '--name-only', cli.args.base_branch] |
57 | out = subprocess.run(base_args + core_dirs, check=True, stdout=subprocess.PIPE) | 59 | out = subprocess.run(base_args + core_dirs, check=True, stdout=subprocess.PIPE) |
58 | changed_files = filter(None, out.stdout.decode('UTF-8').split('\n')) | 60 | changed_files = filter(None, out.stdout.decode('UTF-8').split('\n')) |
59 | filtered_files = [qmk.path.normpath(file) for file in changed_files if not any(i in file for i in ignores)] | 61 | filtered_files = [normpath(file) for file in changed_files if not any(i in file for i in ignores)] |
60 | files.extend(file for file in filtered_files if file.exists() and file.suffix in ['.c', '.h', '.cpp']) | 62 | files.extend(file for file in filtered_files if file.exists() and file.suffix in ['.c', '.h', '.cpp']) |
61 | 63 | ||
62 | # Run clang-format on the files we've found | 64 | # Run clang-format on the files we've found |