mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Add error_handler and use it.
This commit is contained in:
parent
e3d29a897b
commit
9a017dcbe9
8 changed files with 177 additions and 35 deletions
|
|
@ -9,6 +9,7 @@ from pre_commit.commands.clean import clean
|
|||
from pre_commit.commands.install_uninstall import install
|
||||
from pre_commit.commands.install_uninstall import uninstall
|
||||
from pre_commit.commands.run import run
|
||||
from pre_commit.error_handler import error_handler
|
||||
from pre_commit.runner import Runner
|
||||
from pre_commit.util import entry
|
||||
|
||||
|
|
@ -83,28 +84,29 @@ def main(argv):
|
|||
else:
|
||||
parser.parse_args(['--help'])
|
||||
|
||||
runner = Runner.create()
|
||||
with error_handler():
|
||||
runner = Runner.create()
|
||||
|
||||
if args.command == 'install':
|
||||
return install(
|
||||
runner, overwrite=args.overwrite, hooks=args.install_hooks,
|
||||
)
|
||||
elif args.command == 'uninstall':
|
||||
return uninstall(runner)
|
||||
elif args.command == 'clean':
|
||||
return clean(runner)
|
||||
elif args.command == 'autoupdate':
|
||||
return autoupdate(runner)
|
||||
elif args.command == 'run':
|
||||
return run(runner, args)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
'Command {0} not implemented.'.format(args.command)
|
||||
)
|
||||
if args.command == 'install':
|
||||
return install(
|
||||
runner, overwrite=args.overwrite, hooks=args.install_hooks,
|
||||
)
|
||||
elif args.command == 'uninstall':
|
||||
return uninstall(runner)
|
||||
elif args.command == 'clean':
|
||||
return clean(runner)
|
||||
elif args.command == 'autoupdate':
|
||||
return autoupdate(runner)
|
||||
elif args.command == 'run':
|
||||
return run(runner, args)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
'Command {0} not implemented.'.format(args.command)
|
||||
)
|
||||
|
||||
raise AssertionError(
|
||||
'Command {0} failed to exit with a returncode'.format(args.command)
|
||||
)
|
||||
raise AssertionError(
|
||||
'Command {0} failed to exit with a returncode'.format(args.command)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue