Skip to content

Commit cd9d1cf

Browse files
add runstartend to subsystem
1 parent 44b8709 commit cd9d1cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

commands2/subsystem.py

+16
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ def startRun(self, start: Callable[[], None], run: Callable[[], None]) -> Comman
168168

169169
return startRun(start, run, self)
170170

171+
def startRunEnd(self, start: Callable[[], None], run: Callable[[], None], end: Callable[[], None]) -> Command:
172+
"""
173+
Constructs a command that runs an action once, and then runs an action
174+
every iteration until interrupted, and then runs a third action.
175+
every iteration until interrupted, and then runs a third action. Requires
176+
this subsystem.
177+
178+
:param start the action to run on start
179+
:param run the action to run every iteration
180+
:param end the action to run on interrupt
181+
:returns: the command
182+
"""
183+
from .cmd import startRunEnd
184+
185+
return startRunEnd(start, run, end, self)
186+
171187
def idle(self) -> Command:
172188
"""
173189
Constructs a command that does nothing until interrupted. Requires this subsystem.

0 commit comments

Comments
 (0)