aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/python/qmk/cli/pyformat.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/pyformat.py b/lib/python/qmk/cli/pyformat.py
new file mode 100755
index 000000000..b1f8c02b2
--- /dev/null
+++ b/lib/python/qmk/cli/pyformat.py
@@ -0,0 +1,16 @@
1"""Format python code according to QMK's style.
2"""
3from milc import cli
4
5import subprocess
6
7
8@cli.entrypoint("Format python code according to QMK's style.")
9def main(cli):
10 """Format python code according to QMK's style.
11 """
12 try:
13 subprocess.run(['yapf', '-vv', '-ri', 'bin/qmk', 'lib/python'], check=True)
14 cli.log.info('Successfully formatted the python code in `bin/qmk` and `lib/python`.')
15 except subprocess.CalledProcessError:
16 cli.log.error('Error formatting python code!')