Move printing inside the commands for install and uninstall

This commit is contained in:
Anthony Sottile 2014-03-23 20:21:59 -07:00
parent 2f1454bebc
commit c695ee9a9a
2 changed files with 8 additions and 6 deletions

View file

@ -1,4 +1,6 @@
from __future__ import print_function
import os
import pkg_resources
import stat
@ -15,6 +17,9 @@ def install(runner):
runner.pre_commit_path,
original_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH,
)
print('pre-commit installed at {0}'.format(runner.pre_commit_path))
return 0
@ -22,4 +27,5 @@ def uninstall(runner):
"""Uninstall the pre-commit hooks."""
if os.path.exists(runner.pre_commit_path):
os.remove(runner.pre_commit_path)
print('pre-commit uninstalled')
return 0

View file

@ -127,13 +127,9 @@ def run(argv):
runner = Runner.create()
if args.command == 'install':
retval = commands.install(runner)
print 'pre-commit installed at {0}'.format(runner.pre_commit_path)
return retval
return commands.install(runner)
elif args.command == 'uninstall':
retval = commands.uninstall(runner)
print 'pre-commit uninstalled'
return retval
return commands.uninstall(runner)
elif args.command == 'run':
if args.hook:
return run_single_hook(runner, args.hook, all_files=args.all_files)