mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 20:16:53 +00:00
Refactored how entry points work.
This commit is contained in:
parent
5db7f2d807
commit
45741545dc
8 changed files with 71 additions and 42 deletions
|
|
@ -3,7 +3,10 @@ import argparse
|
|||
import sys
|
||||
from plumbum import local
|
||||
|
||||
from pre_commit_hooks.util import entry
|
||||
|
||||
|
||||
@entry
|
||||
def fix_trailing_whitespace(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filenames', nargs='*', help='Filenames to fix')
|
||||
|
|
@ -22,9 +25,5 @@ def fix_trailing_whitespace(argv):
|
|||
return 0
|
||||
|
||||
|
||||
def entry():
|
||||
fix_trailing_whitespace(sys.argv[1:])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(entry())
|
||||
sys.exit(fix_trailing_whitespace())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue