Skip to content

Commit 4d9198a

Browse files
authored
↪️ Merge pull request #321 from Yelp/fix_320
🐛 Fix AttributeError on Windows
2 parents b5ae43a + 7704408 commit 4d9198a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

detect_secrets/core/usage.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def get_parser_to_add_opt_out_options_to(parser):
104104
:rtype: argparse.ArgumentParser
105105
:returns: argparse.ArgumentParser to pass into PluginOptions
106106
"""
107-
if parser.prog == 'detect-secrets-hook':
108-
return parser
109-
110107
for action in parser._actions: # pragma: no cover (Always returns)
111108
if isinstance(action, argparse._SubParsersAction):
112109
for subparser in action.choices.values():
113110
if subparser.prog.endswith('scan'):
114111
return subparser
112+
# Assume it is the 'detect-secrets-hook' console script
113+
# Relying on parser.prog is too brittle
114+
return parser
115115

116116

117117
class ParserBuilder:

0 commit comments

Comments
 (0)