forked from just-install/just-install-updater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjiup.js
55 lines (51 loc) · 1.88 KB
/
jiup.js
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
const jiup = require('./jiup-lib.js');
const process = require('process');
var argUsed = 0;
var help = false;
if(process.argv[2] && process.argv[2].charAt(0) != '-'){
argUsed ++;
var regPath = process.argv[2];
if(process.platform == 'win32' && regPath.charAt(regPath.length-1) != '\\'){
regPath += '\\';
}else if(process.platform == 'linux' && regPath.charAt(regPath.length-1) != '/'){
regPath += '/';
}else if(process.platform != 'linux' && process.platform != 'win32'){
throw "Only linux and windows are currently supported.";
}
}else{
regPath = '';
}
process.argv.slice(2+argUsed).forEach(function (val, index, array) {
if(val.charAt(0) == '-'){
if(val == '-h' || val == '-help'){
showHelp();
help = true;
}else if(jiup.args[val] != undefined){
jiup.args[val] = true;
}
}else{
jiup.appList.push(val);
}
});
if(help == false){
if(regPath == ''){
throw "A path to the just-install dev folder was not specified. Start the script with -h for help.";
}else{
jiup.init(regPath);
}
}
function showHelp(){
var s = ' ';
console.log('\nUSAGE:');
console.log(s+'node jiup path [options] [packages]');
console.log('\npath:');
console.log(s+'Absolute path to the just-install development folder.');
console.log('\npackages:');
console.log(s+'An optional space separated list of packages to update. By default, all packages are updated.');
console.log('\noptions:');
console.log(s+'-c : Commit: A prompt will allow committing the registry file to Git.');
console.log(s+'-ns: No save: Changes to the registry file are not saved.');
console.log(s+'-f : Force mode: Packages that would otherwise be skipped will be processed.');
console.log(s+'-v : Verbose: Outputs additional info, best used for debugging a single package.');
console.log(s+'-todo : Displays the just-install entries for which no update rules exist.');
}