@@ -62,6 +62,7 @@ const (
62
62
enterNavigatorRoleMenuHelper = "Navigator role"
63
63
openBrowserMenuHelper = "Open in browser"
64
64
gitAutoPushMenuHelper = "Turn on/off git auto-push"
65
+ abortCommandMenuHelper = "Abort current command"
65
66
quitMenuHelper = "Quit"
66
67
optionsMenuHelper = "List available options"
67
68
timerStatusMenuHelper = "Timer status"
@@ -290,6 +291,10 @@ func (term *TerminalUI) vcsPush() {
290
291
term .tcr .VCSPush ()
291
292
}
292
293
294
+ func (term * TerminalUI ) abortCommand () {
295
+ term .tcr .AbortCommand ()
296
+ }
297
+
293
298
func (term * TerminalUI ) whatShallWeDo () {
294
299
if term .params .Mode .IsMultiRole () {
295
300
term .listMenuOptions (term .mobMenu , "What shall we do?" )
@@ -444,6 +449,9 @@ func (term *TerminalUI) initSoloMenu() *menu {
444
449
newMenuOption ('Y' , syncMenuHelper ,
445
450
term .p4MenuEnabler (),
446
451
term .vcsPullMenuAction (), false ),
452
+ newMenuOption ('A' , abortCommandMenuHelper ,
453
+ term .abortCommandEnabler (),
454
+ term .abortCommandMenuAction (), false ),
447
455
newMenuOption ('Q' , quitTCRMenuHelper ,
448
456
term .quitRoleMenuEnabler (role.Driver {}),
449
457
term .quitRoleMenuAction (), true ),
@@ -480,6 +488,9 @@ func (term *TerminalUI) initMobMenu() *menu {
480
488
newMenuOption ('Y' , syncMenuHelper ,
481
489
term .p4MenuEnabler (),
482
490
term .vcsPullMenuAction (), false ),
491
+ newMenuOption ('A' , abortCommandMenuHelper ,
492
+ term .abortCommandEnabler (),
493
+ term .abortCommandMenuAction (), false ),
483
494
newMenuOption ('Q' , quitMenuHelper ,
484
495
term .quitRoleMenuEnabler (nil ),
485
496
term .quitMenuAction (), true ),
@@ -554,6 +565,12 @@ func (term *TerminalUI) vcsPushMenuAction() menuAction {
554
565
}
555
566
}
556
567
568
+ func (term * TerminalUI ) abortCommandMenuAction () menuAction {
569
+ return func () {
570
+ term .abortCommand ()
571
+ }
572
+ }
573
+
557
574
func (term * TerminalUI ) optionsMenuAction (m * menu ) menuAction {
558
575
return func () {
559
576
term .listMenuOptions (m , "Available Options:" )
@@ -579,6 +596,14 @@ func (term *TerminalUI) timerStatusMenuAction() menuAction {
579
596
}
580
597
}
581
598
599
+ func (term * TerminalUI ) abortCommandEnabler () menuEnabler {
600
+ return func () bool {
601
+ // For now we only enable this shortcut when in driver role.
602
+ // We may need to enable it more widely when we extend abort to VCS commands as well
603
+ return term .tcr .GetCurrentRole () == role.Driver {}
604
+ }
605
+ }
606
+
582
607
func (term * TerminalUI ) quitRoleMenuEnabler (r role.Role ) menuEnabler {
583
608
return func () bool {
584
609
return term .tcr .GetCurrentRole () == r
0 commit comments