Skip to content

Commit

Permalink
↪️ Merge pull request Yelp#321 from Yelp/fix_320
Browse files Browse the repository at this point in the history
🐛 Fix AttributeError on Windows
  • Loading branch information
KevinHock authored Jul 23, 2020
2 parents b5ae43a + 7704408 commit 4d9198a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions detect_secrets/core/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ def get_parser_to_add_opt_out_options_to(parser):
:rtype: argparse.ArgumentParser
:returns: argparse.ArgumentParser to pass into PluginOptions
"""
if parser.prog == 'detect-secrets-hook':
return parser

for action in parser._actions: # pragma: no cover (Always returns)
if isinstance(action, argparse._SubParsersAction):
for subparser in action.choices.values():
if subparser.prog.endswith('scan'):
return subparser
# Assume it is the 'detect-secrets-hook' console script
# Relying on parser.prog is too brittle
return parser


class ParserBuilder:
Expand Down

0 comments on commit 4d9198a

Please sign in to comment.