diff options
Diffstat (limited to 'lib/python/qmk/cli/pyformat.py')
| -rwxr-xr-x | lib/python/qmk/cli/pyformat.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/python/qmk/cli/pyformat.py b/lib/python/qmk/cli/pyformat.py index b1f8c02b2..a53ba40c0 100755 --- a/lib/python/qmk/cli/pyformat.py +++ b/lib/python/qmk/cli/pyformat.py | |||
| @@ -5,12 +5,13 @@ from milc import cli | |||
| 5 | import subprocess | 5 | import subprocess |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | @cli.entrypoint("Format python code according to QMK's style.") | 8 | @cli.subcommand("Format python code according to QMK's style.") |
| 9 | def main(cli): | 9 | def pyformat(cli): |
| 10 | """Format python code according to QMK's style. | 10 | """Format python code according to QMK's style. |
| 11 | """ | 11 | """ |
| 12 | try: | 12 | try: |
| 13 | subprocess.run(['yapf', '-vv', '-ri', 'bin/qmk', 'lib/python'], check=True) | 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`.') | 14 | cli.log.info('Successfully formatted the python code in `bin/qmk` and `lib/python`.') |
| 15 | |||
| 15 | except subprocess.CalledProcessError: | 16 | except subprocess.CalledProcessError: |
| 16 | cli.log.error('Error formatting python code!') | 17 | cli.log.error('Error formatting python code!') |
