summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/fileformat.py
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-07-20 11:52:14 -0700
committerGitHub <noreply@github.com>2021-07-20 11:52:14 -0700
commit4ab8734d6edd6894757507e70264eddca5429052 (patch)
treeb43ad3f47426d3c194b05d02ae5ff34d6b0c1301 /lib/python/qmk/cli/fileformat.py
parentc4db9f7fb2a359abb1db06e3d74a52dce8bdf68c (diff)
Move all our CLI file formatters to the format dir (#13296)
* move all our file formatters to the format dir * Apply suggestions from code review Co-authored-by: Erovia <Erovia@users.noreply.github.com> Co-authored-by: Erovia <Erovia@users.noreply.github.com>
Diffstat (limited to 'lib/python/qmk/cli/fileformat.py')
-rwxr-xr-x[-rw-r--r--]lib/python/qmk/cli/fileformat.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/python/qmk/cli/fileformat.py b/lib/python/qmk/cli/fileformat.py
index 112d8d59da..cee4ba1acd 100644..100755
--- a/lib/python/qmk/cli/fileformat.py
+++ b/lib/python/qmk/cli/fileformat.py
@@ -1,13 +1,23 @@
-"""Format files according to QMK's style.
+"""Point people to the new command name.
"""
-from milc import cli
+import sys
+from pathlib import Path
-import subprocess
+from milc import cli
-@cli.subcommand("Format files according to QMK's style.", hidden=True)
+@cli.subcommand('Pointer to the new command name: qmk format-text.', hidden=True)
def fileformat(cli):
- """Run several general formatting commands.
+ """Pointer to the new command name: qmk format-text.
"""
- dos2unix = subprocess.run(['bash', '-c', 'git ls-files -z | xargs -0 dos2unix'], stdout=subprocess.DEVNULL)
- return dos2unix.returncode
+ cli.log.warning('"qmk fileformat" has been renamed to "qmk format-text". Please use the new command in the future.')
+ argv = [sys.executable, *sys.argv]
+ argv[argv.index('fileformat')] = 'format-text'
+ script_path = Path(argv[1])
+ script_path_exe = Path(f'{argv[1]}.exe')
+
+ if not script_path.exists() and script_path_exe.exists():
+ # For reasons I don't understand ".exe" is stripped from the script name on windows.
+ argv[1] = str(script_path_exe)
+
+ return cli.run(argv, capture_output=False).returncode