mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Fix entry_points
This commit is contained in:
parent
eb592046e3
commit
18976b501d
6 changed files with 32 additions and 24 deletions
23
pre_commit/entry_points.py
Normal file
23
pre_commit/entry_points.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
import functools
|
||||
|
||||
import pre_commit.clientlib.validate_manifest
|
||||
import pre_commit.run
|
||||
|
||||
|
||||
def make_entry_point(entry_point_func):
|
||||
"""Decorator which turns a function which takes sys.argv[1:] and returns
|
||||
an integer into an argumentless function which returns an integer.
|
||||
|
||||
Args:
|
||||
entry_point_func - A function which takes an array representing argv
|
||||
"""
|
||||
@functools.wraps(entry_point_func)
|
||||
def func():
|
||||
import sys
|
||||
return entry_point_func(sys.argv[1:])
|
||||
return func
|
||||
|
||||
|
||||
pre_commit_func = make_entry_point(pre_commit.run.run)
|
||||
validate_manifest_func = make_entry_point(pre_commit.clientlib.validate_manifest.run)
|
||||
Loading…
Add table
Add a link
Reference in a new issue