mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Move printing inside the commands for install and uninstall
This commit is contained in:
parent
2f1454bebc
commit
c695ee9a9a
2 changed files with 8 additions and 6 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import stat
|
import stat
|
||||||
|
|
@ -15,6 +17,9 @@ def install(runner):
|
||||||
runner.pre_commit_path,
|
runner.pre_commit_path,
|
||||||
original_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH,
|
original_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print('pre-commit installed at {0}'.format(runner.pre_commit_path))
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,4 +27,5 @@ def uninstall(runner):
|
||||||
"""Uninstall the pre-commit hooks."""
|
"""Uninstall the pre-commit hooks."""
|
||||||
if os.path.exists(runner.pre_commit_path):
|
if os.path.exists(runner.pre_commit_path):
|
||||||
os.remove(runner.pre_commit_path)
|
os.remove(runner.pre_commit_path)
|
||||||
|
print('pre-commit uninstalled')
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -127,13 +127,9 @@ def run(argv):
|
||||||
runner = Runner.create()
|
runner = Runner.create()
|
||||||
|
|
||||||
if args.command == 'install':
|
if args.command == 'install':
|
||||||
retval = commands.install(runner)
|
return commands.install(runner)
|
||||||
print 'pre-commit installed at {0}'.format(runner.pre_commit_path)
|
|
||||||
return retval
|
|
||||||
elif args.command == 'uninstall':
|
elif args.command == 'uninstall':
|
||||||
retval = commands.uninstall(runner)
|
return commands.uninstall(runner)
|
||||||
print 'pre-commit uninstalled'
|
|
||||||
return retval
|
|
||||||
elif args.command == 'run':
|
elif args.command == 'run':
|
||||||
if args.hook:
|
if args.hook:
|
||||||
return run_single_hook(runner, args.hook, all_files=args.all_files)
|
return run_single_hook(runner, args.hook, all_files=args.all_files)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue