From c695ee9a9a78ac73439c52e0085bafec8037bc2d Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sun, 23 Mar 2014 20:21:59 -0700 Subject: [PATCH] Move printing inside the commands for install and uninstall --- pre_commit/commands.py | 6 ++++++ pre_commit/run.py | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pre_commit/commands.py b/pre_commit/commands.py index 1411340c..2ace2606 100644 --- a/pre_commit/commands.py +++ b/pre_commit/commands.py @@ -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 diff --git a/pre_commit/run.py b/pre_commit/run.py index 39189e0f..2826c44a 100644 --- a/pre_commit/run.py +++ b/pre_commit/run.py @@ -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)