-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
83 lines (74 loc) · 1.7 KB
/
index.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var path = require('path');
var fs = require('fs');
var shell = require('child_process');
var help = require('./help');
var log = console.log;
var args = process.argv;
args.shift();
args.shift();
var arg = args[0];
function findPath(name){
return path.resolve(path.join(__dirname, name))
}
function exit(text){
console.log(text);
process.exit(1);
}
var acts = {
"theme": (args) => {
var todo = "";
if(args[0] == 'gui'){
todo = "python3 "+findPath('theme/main.py')
} else if(args[0] == 'custom'){
todo = "gnome-tweaks"
} else {
var a = shell.fork(findPath('theme/index.js'), process.argv);
a.on('exit', (code) => {
if(code) process.exit(1);
});
// todo = "node "+findPath('theme/index.js')+" "+args.join(" ");
return 0;
}
// shell.spawn(todo);
shell.exec(todo);
// shell.exec(todo, (...e) => console.log(e));
return 0;
},
"desk": (args) => {
var a = shell.fork(findPath('desk/index.js'), process.argv);
a.on('exit', (code) => {
if(code) process.exit(1);
});
},
"lang": (args) => {
var a = shell.fork(findPath('lang/main.js'), process.argv);
a.on('exit', (code) => {
if(code) process.exit(1);
});
},
"gui": (args) => {
shell.exec("python3 "+findPath('gui/win.py'));
},
"find": (args) => {
console.log(shell.execSync("java "+findPath('srch/main.java') + " " + args.join(' ')).toString().trim())
}
}
acts["-h"] = acts["--help"] = acts["help"] = (args) => {
help({
'theme': {
'args': ['[, args]'],
'text': "Changes themes"
},
'desk': {
'args': ['[, args]'],
'text': "Changes desktop setup"
},
})
}
if(arg in acts){
var act = args.shift();
acts[arg](args);
} else {
log('Dawg, don\'t you know the bushy commands?');
process.exit(1);
}