forked from ionic-team/ionic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio-config.js
More file actions
60 lines (52 loc) · 1.45 KB
/
io-config.js
File metadata and controls
60 lines (52 loc) · 1.45 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
50
51
52
53
54
55
56
57
58
59
60
var ioLib = require('ionic-app-lib').ioConfig,
argv = require('optimist').argv,
fs = require('fs'),
prompt = require('prompt'),
IonicProject = require('./project'),
IonicTask = require('./task').IonicTask,
Task = require('./task').Task,
IonicLoginTask = require('./login').IonicTask;
var IonicTask = function() {};
IonicTask.prototype = new Task();
IonicTask.prototype.run = function(ionic) {
var self = this;
self.ionic = ionic;
self.project = null;
try {
self.project = IonicProject.load();
} catch (ex) {
self.ionic.fail(ex.message);
return
}
var set = false,
write = false,
key = '',
val = '';
if (argv['_'][1] == 'set' || argv['_'][1] == 'unset' || argv['_'][1] == 'build' || argv['_'][1] == 'info') {
if (argv['_'][1] == 'build') {
write = true;
ioLib.writeIoConfig(false, false, true);
} else if (argv['_'][1] == 'info') {
write = true;
ioLib.listConfig();
} else {
if (argv['_'][1] == 'set') {
set = true;
}
if (argv['_'][2]) {
key = argv['_'][2];
if (argv['_'][3] && set) {
val = argv['_'][3];
}
} else {
self.ionic.fail("Invalid syntax, use 'ionic config <command> key value'");
}
}
} else {
self.ionic.fail("Invalid command, must use 'set', 'unset', 'build', or 'info'");
}
if (!write) {
ioLib.writeIoConfig(key, val, set);
}
};
exports.IonicTask = IonicTask;