@@ -17,14 +17,30 @@ + (NSArray *) commandsForSubmodule:(PBGitSubmodule *) submodule inRepository:(PB
17
17
NSMutableArray *commands = [[NSMutableArray alloc ] init ];
18
18
19
19
NSString *repoPath = [repository workingDirectory ];
20
-
21
20
NSString *path = [repoPath stringByAppendingPathComponent: [submodule path ]];
22
21
22
+ // open
23
23
PBOpenDocumentCommand *command = [[PBOpenDocumentCommand alloc ] initWithDocumentAbsolutePath: path];
24
24
command.commandTitle = command.displayName ;
25
25
command.commandDescription = @" Opening document" ;
26
+ command.canBeFired = ([submodule path ] && [submodule submoduleState ] != PBGitSubmoduleStateNotInitialized);
26
27
[commands addObject: command];
27
-
28
+
29
+ // update
30
+ NSString *submodulePath = [submodule path ];
31
+ NSArray *params = [NSArray arrayWithObjects: @" submodule" , @" update" , nil ];
32
+ PBCommand *updateCmd = [[PBCommand alloc ] initWithDisplayName: @" Update submodule" parameters: params repository: repository];
33
+ updateCmd.commandTitle = updateCmd.displayName ;
34
+ updateCmd.commandDescription = @" Updating submodule" ;
35
+ [commands addObject: updateCmd];
36
+
37
+ // update recursively
38
+ NSArray *recursiveUpdate = [NSArray arrayWithObjects: @" submodule" , @" update" , @" --recursive" , nil ];
39
+ PBCommand *updateRecursively = [[PBCommand alloc ] initWithDisplayName: @" Update submodule recursively" parameters: recursiveUpdate repository: repository];
40
+ updateRecursively.commandTitle = updateRecursively.displayName ;
41
+ updateRecursively.commandDescription = [NSString stringWithFormat: @" Updating submodule %@ (recursively)" , submodulePath];
42
+ [commands addObject: updateRecursively];
43
+
28
44
return commands;
29
45
}
30
46
0 commit comments