You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contribute.m
+28-7Lines changed: 28 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
function contribute(repoName, printLevel)
1
+
function contribute(repoName, printLevel, autoOption)
2
2
% devTools
3
3
%
4
4
% PURPOSE: displays a menu and calls the respective subfunctions
@@ -7,11 +7,14 @@ function contribute(repoName, printLevel)
7
7
% 2. Select an existing feature (branch) to work on.
8
8
% 3. Publish a feature (branch).
9
9
% 4. Delete a feature (branch).
10
+
% 5. Update the fork
10
11
%
11
12
% INPUT:
12
13
%
14
+
% repoName: Name of the repository (default: opencobra/cobratoolbox)
13
15
% printLevel: 0: minimal printout (default)
14
16
% 1: detailed printout (debug mode)
17
+
% autoOption: menu option
15
18
16
19
globalgitConf
17
20
globalgitCmd
@@ -26,16 +29,31 @@ function contribute(repoName, printLevel)
26
29
% adding the src folder of the devTools
27
30
addpath(genpath(fileparts(which(mfilename))));
28
31
32
+
% check the automatic option argument
33
+
if exist('autoOption', 'var')
34
+
if ~isempty(autoOption)
35
+
ifautoOption>0&&autoOption<6
36
+
autoOptionFlag =true;
37
+
else
38
+
error('Please enter an automatic menu option between 1 and 5.')
39
+
end
40
+
end
41
+
else
42
+
autoOptionFlag =false;
43
+
end
44
+
29
45
% treatment of input arguments
30
-
if ~exist('repoName', 'var')
46
+
if ~exist('repoName', 'var')|| isempty(repoName)
31
47
DEFAULTREPONAME ='opencobra/cobratoolbox'; % set the default repository
32
48
repoName =DEFAULTREPONAME;
33
49
end
34
50
35
51
% soft reset if the repository name is different
36
52
if ~isempty(gitConf)
37
-
if ~strcmpi(repoName, [gitConf.remoteUserName '/'gitConf.remoteRepoName])
38
-
resetDevTools();
53
+
if isfield(gitConf, 'remoteUserName') && isfield(gitConf, 'remoteRepoName')
54
+
if exist('repoName', 'var') && ~strcmpi(repoName, [gitConf.remoteUserName '/'gitConf.remoteRepoName])
55
+
resetDevTools();
56
+
end
39
57
end
40
58
end
41
59
@@ -58,9 +76,12 @@ function contribute(repoName, printLevel)
58
76
59
77
fprintf(gitConf.launcher);
60
78
61
-
choice = input('\n (You can abort any process using CTRL+C)\n\n [1] Start a new feature (branch).\n [2] Select an existing feature (branch) to work on.\n [3] Publish a feature (branch).\n [4] Delete a feature (branch).\n [5] Update the fork.\n\n -> Please select what you want to do (enter the number): ', 's');
62
-
63
-
choice = str2num(choice);
79
+
ifautoOptionFlag
80
+
choice =autoOption;
81
+
else
82
+
choice = input('\n (You can abort any process using CTRL+C)\n\n [1] Start a new feature (branch).\n [2] Select an existing feature (branch) to work on.\n [3] Publish a feature (branch).\n [4] Delete a feature (branch).\n [5] Update the fork.\n\n -> Please select what you want to do (enter the number): ', 's');
0 commit comments