@@ -20,6 +20,7 @@ enum MenuAction {
2020 Push ,
2121 Pull ,
2222 PullRebase ,
23+ PullSubmodules ,
2324}
2425
2526struct MenuItem {
@@ -50,7 +51,7 @@ impl ContextMenu {
5051 }
5152 }
5253
53- pub fn show ( & mut self , repo_index : usize , col : u16 , row : u16 , ahead : usize , behind : usize ) {
54+ pub fn show ( & mut self , repo_index : usize , col : u16 , row : u16 , ahead : usize , behind : usize , has_submodules : bool ) {
5455 self . visible = true ;
5556 self . repo_index = repo_index;
5657 self . position = ( col, row) ;
@@ -90,6 +91,13 @@ impl ContextMenu {
9091 } ,
9192 ] ;
9293
94+ if has_submodules {
95+ self . items . push ( MenuItem {
96+ label : "Pull --recurse-subs" . into ( ) ,
97+ action : MenuAction :: PullSubmodules ,
98+ } ) ;
99+ }
100+
93101 self . state . select ( Some ( 0 ) ) ;
94102 }
95103
@@ -142,6 +150,7 @@ impl ContextMenu {
142150 MenuAction :: Push => Action :: GitPush ( self . repo_index ) ,
143151 MenuAction :: Pull => Action :: GitPull ( self . repo_index ) ,
144152 MenuAction :: PullRebase => Action :: GitPullRebase ( self . repo_index ) ,
153+ MenuAction :: PullSubmodules => Action :: GitPullSubmodules ( self . repo_index ) ,
145154 } ;
146155 self . hide ( ) ;
147156 Some ( action)
@@ -232,7 +241,7 @@ impl Component for ContextMenu {
232241 . map ( |item| {
233242 let style = match item. action {
234243 MenuAction :: Push => Style :: default ( ) . fg ( Color :: Green ) ,
235- MenuAction :: Pull | MenuAction :: PullRebase => Style :: default ( ) . fg ( Color :: Yellow ) ,
244+ MenuAction :: Pull | MenuAction :: PullRebase | MenuAction :: PullSubmodules => Style :: default ( ) . fg ( Color :: Yellow ) ,
236245 _ => Style :: default ( ) ,
237246 } ;
238247 ListItem :: new ( Line :: from ( Span :: styled ( & item. label , style) ) )
0 commit comments