fileformat.py 815 B

1234567891011121314151617181920212223
  1. """Point people to the new command name.
  2. """
  3. import sys
  4. from pathlib import Path
  5. from milc import cli
  6. @cli.subcommand('Pointer to the new command name: qmk format-text.', hidden=True)
  7. def fileformat(cli):
  8. """Pointer to the new command name: qmk format-text.
  9. """
  10. cli.log.warning('"qmk fileformat" has been renamed to "qmk format-text". Please use the new command in the future.')
  11. argv = [sys.executable, *sys.argv]
  12. argv[argv.index('fileformat')] = 'format-text'
  13. script_path = Path(argv[1])
  14. script_path_exe = Path(f'{argv[1]}.exe')
  15. if not script_path.exists() and script_path_exe.exists():
  16. # For reasons I don't understand ".exe" is stripped from the script name on windows.
  17. argv[1] = str(script_path_exe)
  18. return cli.run(argv, capture_output=False).returncode