Skip to content

Commit 25dd76d

Browse files
author
Caspar van Leeuwen
committed
Make sure that commands still function if no action filters were defined. Also, log the general args to the log
1 parent 583cacc commit 25dd76d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/commands.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def __init__(self, cmd_str):
8888
cmd_as_list = cmd_str.split()
8989
self.command = cmd_as_list[0] # E.g. 'build' or 'help'
9090
self.general_args = []
91+
self.action_filters = None
9192

9293
# TODO always init self.action_filters with empty EESSIBotActionFilter?
9394
if len(cmd_as_list) > 1:
@@ -145,6 +146,7 @@ def __init__(self, cmd_str):
145146
# so no special parsing needed there
146147
log(f"Extracted filter arguments related to hardware target: {normalized_filters}")
147148
log(f"Other extracted filter arguments: {other_filter_args}")
149+
log(f"Other general arguments: {self.general_args}")
148150
normalized_filters += other_filter_args
149151

150152
# Finally, change into a space-separated string, as expected by EESSIBotActionFilter
@@ -175,5 +177,8 @@ def to_string(self):
175177
Returns:
176178
string: the string representation created by the method
177179
"""
178-
action_filters_str = self.action_filters.to_string()
179-
return f"{' '.join([self.command, action_filters_str]).rstrip()}"
180+
if self.action_filters is None:
181+
return ""
182+
else:
183+
action_filters_str = self.action_filters.to_string()
184+
return f"{' '.join([self.command, action_filters_str]).rstrip()}"

0 commit comments

Comments
 (0)