Skip to content

Commit 2b1650f

Browse files
committed
Support multiple flags in ExtendMatch
Previously, each "option string" defined its own set of passes. This would produce the wrong behavior for any case where the user defines an ExtendMatch action with multiple flags. After this change, the flag name used as a key is the first in the list of possible flags. This enables ExtendMatch actions with multiple flags to store everything in a single list. Signed-off-by: John Pennycook <john.pennycook@intel.com>
1 parent 6b76126 commit 2b1650f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

codebasin/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def __init__(
126126
):
127127
self.pattern = kwargs.pop("pattern", None)
128128
self.format = kwargs.pop("format", None)
129+
self.flag_name = option_strings[0]
129130
super().__init__(option_strings, dest, nargs=nargs, **kwargs)
130131

131132
def __call__(
@@ -143,9 +144,9 @@ def __call__(
143144
matches = [template.substitute(value=v) for v in matches]
144145
if self.dest == "passes":
145146
passes = getattr(namespace, self.dest)
146-
if option_string not in passes:
147-
passes[option_string] = []
148-
passes[option_string].extend(matches)
147+
if self.flag_name not in passes:
148+
passes[self.flag_name] = []
149+
passes[self.flag_name].extend(matches)
149150
else:
150151
dest = getattr(namespace, self.dest)
151152
dest.extend(matches)

0 commit comments

Comments
 (0)