diff options
author | William Chang <[email protected]> | 2019-11-20 22:17:07 -0800 |
---|---|---|
committer | William Chang <[email protected]> | 2019-11-20 22:17:07 -0800 |
commit | e7f4d56592b3975c38af329e77b4efd9108495e8 (patch) | |
tree | 0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /lib/python/qmk/cli/pyformat.py | |
parent | 71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff) | |
parent | 8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff) | |
download | qmk_firmware-e7f4d56592b3975c38af329e77b4efd9108495e8.tar.gz qmk_firmware-e7f4d56592b3975c38af329e77b4efd9108495e8.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/python/qmk/cli/pyformat.py')
-rwxr-xr-x | lib/python/qmk/cli/pyformat.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/pyformat.py b/lib/python/qmk/cli/pyformat.py new file mode 100755 index 0000000000..a53ba40c0a --- /dev/null +++ b/lib/python/qmk/cli/pyformat.py @@ -0,0 +1,17 @@ +"""Format python code according to QMK's style. +""" +from milc import cli + +import subprocess + + [email protected]("Format python code according to QMK's style.") +def pyformat(cli): + """Format python code according to QMK's style. + """ + try: + subprocess.run(['yapf', '-vv', '-ri', 'bin/qmk', 'lib/python'], check=True) + cli.log.info('Successfully formatted the python code in `bin/qmk` and `lib/python`.') + + except subprocess.CalledProcessError: + cli.log.error('Error formatting python code!') |