clean: separate store from runner

This commit is contained in:
Anthony Sottile 2018-06-29 20:08:23 -07:00
parent 0e430be0ce
commit 6d683a5fac
4 changed files with 12 additions and 21 deletions

View file

@ -7,9 +7,9 @@ from pre_commit import output
from pre_commit.util import rmtree
def clean(runner):
def clean(store):
legacy_path = os.path.expanduser('~/.pre-commit')
for directory in (runner.store.directory, legacy_path):
for directory in (store.directory, legacy_path):
if os.path.exists(directory):
rmtree(directory)
output.write_line('Cleaned {}.'.format(directory))

View file

@ -243,7 +243,7 @@ def main(argv=None):
elif args.command == 'uninstall':
return uninstall(runner, hook_type=args.hook_type)
elif args.command == 'clean':
return clean(runner)
return clean(runner.store)
elif args.command == 'autoupdate':
if args.tags_only:
logger.warning('--tags-only is the default')