mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-11 13:44:17 +00:00
Reuse variable definition
This commit is contained in:
parent
2b28f4f051
commit
22b228210e
1 changed files with 5 additions and 5 deletions
|
|
@ -86,7 +86,7 @@ def _parse_arguments(argv=None):
|
||||||
'-f',
|
'-f',
|
||||||
'--fix',
|
'--fix',
|
||||||
choices=[m.opt_name for m in MixedLineEndingOption],
|
choices=[m.opt_name for m in MixedLineEndingOption],
|
||||||
default='auto',
|
default=MixedLineEndingOption.AUTO.opt_name,
|
||||||
help='Replace line ending with the specified. Default is "auto"')
|
help='Replace line ending with the specified. Default is "auto"')
|
||||||
parser.add_argument('filenames', nargs='*', help='Filenames to fix')
|
parser.add_argument('filenames', nargs='*', help='Filenames to fix')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
@ -97,13 +97,13 @@ def _parse_arguments(argv=None):
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
fix = None
|
fix = None
|
||||||
if args.fix == 'auto':
|
if args.fix == MixedLineEndingOption.AUTO.opt_name:
|
||||||
fix = MixedLineEndingOption.AUTO
|
fix = MixedLineEndingOption.AUTO
|
||||||
elif args.fix == 'no':
|
elif args.fix == MixedLineEndingOption.NO.opt_name:
|
||||||
fix = MixedLineEndingOption.NO
|
fix = MixedLineEndingOption.NO
|
||||||
elif args.fix == 'crlf':
|
elif args.fix == MixedLineEndingOption.CRLF.opt_name:
|
||||||
fix = MixedLineEndingOption.CRLF
|
fix = MixedLineEndingOption.CRLF
|
||||||
elif args.fix == 'lf':
|
elif args.fix == MixedLineEndingOption.LF.opt_name:
|
||||||
fix = MixedLineEndingOption.LF
|
fix = MixedLineEndingOption.LF
|
||||||
|
|
||||||
options = {'fix': fix, 'filenames': args.filenames, 'verbose': args.verbose}
|
options = {'fix': fix, 'filenames': args.filenames, 'verbose': args.verbose}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue