mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Use enum instead of raw argparse result
This commit is contained in:
parent
93194b9c6a
commit
b2b0d5929a
1 changed files with 15 additions and 3 deletions
|
|
@ -27,9 +27,9 @@ class MixedLineEndingOption(CLIOption):
|
|||
|
||||
|
||||
def mixed_line_ending(argv=None):
|
||||
args = _parse_arguments(argv)
|
||||
options = _parse_arguments(argv)
|
||||
|
||||
print(args.fix)
|
||||
print(options)
|
||||
|
||||
return 0
|
||||
|
||||
|
|
@ -49,7 +49,19 @@ def _parse_arguments(argv=None):
|
|||
help='Increase output verbosity')
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
return args
|
||||
fix = None
|
||||
if args.fix == 'auto':
|
||||
fix = MixedLineEndingOption.AUTO
|
||||
elif args.fix == 'no':
|
||||
fix = MixedLineEndingOption.NO
|
||||
elif args.fix == 'crlf':
|
||||
fix = MixedLineEndingOption.CRLF
|
||||
elif args.fix == 'lf':
|
||||
fix = MixedLineEndingOption.LF
|
||||
|
||||
options = {'fix': fix, 'verbose': args.verbose}
|
||||
|
||||
return options
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue