mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 04:50:20 -06:00
Implement the clean command.
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import print_function
|
||||
|
||||
import os
|
||||
import pkg_resources
|
||||
import shutil
|
||||
import stat
|
||||
from plumbum import local
|
||||
|
||||
@@ -117,3 +118,10 @@ def autoupdate(runner):
|
||||
)
|
||||
|
||||
return retv
|
||||
|
||||
|
||||
def clean(runner):
|
||||
if os.path.exists(runner.hooks_workspace_path):
|
||||
shutil.rmtree(runner.hooks_workspace_path)
|
||||
print('Cleaned {0}.'.format(runner.hooks_workspace_path))
|
||||
return 0
|
||||
|
||||
@@ -100,6 +100,8 @@ def run(argv):
|
||||
|
||||
subparsers.add_parser('uninstall', help='Uninstall the pre-commit script.')
|
||||
|
||||
subparsers.add_parser('clean', help='Clean out pre-commit files.')
|
||||
|
||||
subparsers.add_parser('autoupdate', help='Auto-update hooks config.')
|
||||
|
||||
run = subparsers.add_parser('run', help='Run hooks.')
|
||||
@@ -123,6 +125,8 @@ def run(argv):
|
||||
return commands.install(runner)
|
||||
elif args.command == 'uninstall':
|
||||
return commands.uninstall(runner)
|
||||
elif args.command == 'clean':
|
||||
return commands.clean(runner)
|
||||
elif args.command == 'autoupdate':
|
||||
return commands.autoupdate(runner)
|
||||
elif args.command == 'run':
|
||||
|
||||
Reference in New Issue
Block a user