mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 12:54:17 +00:00
Add mixed-line-ending processor
This commit is contained in:
parent
56d45435f4
commit
3d4fb41d8a
1 changed files with 27 additions and 0 deletions
27
pre_commit_hooks/mixed_line_ending.py
Normal file
27
pre_commit_hooks/mixed_line_ending.py
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def mixed_line_ending(argv=None):
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
'-f',
|
||||||
|
'--fix',
|
||||||
|
choices=['auto', 'crlf', 'lf', 'no'],
|
||||||
|
default='auto',
|
||||||
|
help='Replace line ending with the specified. Default is "auto"',
|
||||||
|
nargs=1)
|
||||||
|
parser.add_argument(
|
||||||
|
'-v',
|
||||||
|
'--verbose',
|
||||||
|
action="store_true",
|
||||||
|
help='Increase output verbosity')
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
|
print(args.fix)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(mixed_line_ending())
|
||||||
Loading…
Add table
Add a link
Reference in a new issue