Files
zsa_qmk_firmware/lib/python/qmk/cli/pyformat.py
T

18 lines
522 B
Python
Raw Normal View History

2019-08-22 09:40:12 -07:00
"""Format python code according to QMK's style.
"""
from milc import cli
import subprocess
2019-09-22 13:25:33 -07:00
@cli.subcommand("Format python code according to QMK's style.")
def pyformat(cli):
2019-08-22 09:40:12 -07:00
"""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`.')
2019-09-22 13:25:33 -07:00
2019-08-22 09:40:12 -07:00
except subprocess.CalledProcessError:
cli.log.error('Error formatting python code!')