-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathcommand_submodule_update.js
More file actions
49 lines (39 loc) · 1.24 KB
/
command_submodule_update.js
File metadata and controls
49 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
var async = require('grunt').util.async;
var grunt = require('grunt');
var stringUtil = require('underscore.string');
module.exports = function (task, exec, done) {
var optionKey;
var allowedOptions = {
init: false,
remote: false,
force: false,
rebase: false,
merge: false,
reference: null,
depth: null,
recursive: false,
noFetch: false
};
var options = task.options(allowedOptions);
var args = ['submodule', 'update'];
// Loop through allowable cli flags in options and add to args
for (optionKey in allowedOptions) {
if (options[optionKey] !== undefined && options[optionKey] !== null && options[optionKey] !== false) {
// Add flag
args.push('--' + stringUtil.dasherize(optionKey));
// If not a boolean, add the value after the flag
if (typeof options[optionKey] !== 'boolean') {
args.push(options[optionKey]);
}
}
}
// If a path was specified, add it now:
if (options.path) {
args.push(options.path);
}
// Add callback
args.push(done);
exec.apply(this, args);
};
module.exports.description = 'Update git submodules.';