-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·60 lines (48 loc) · 1.22 KB
/
main.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
const { app, BrowserWindow } = require('electron');
const { callCmd } = require('./src/script');
const { readInFile } = require('./src/prepFile');
let win;
function createWindow() {
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
win.loadFile('index.html');
// win.webContents.openDevTools();
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
const cData =
callCmd('apt list --installed | tee data/apps.txt')
.then((data) => {
return data.replace('Listing...\n', '').split('\n');
});
function parseDate(cData) {
data = cData.then((data) => { return data; });
data.then((d) => console.log(d));
console.log(typeof(data));
data.forEach(function (part, index) {
app = part.split('/');
data[index] = app[0];
});
return data;
}
data = parseDate(cData);
data.then(d => { console.log(d); });
// readInFile();
// callCmd('lsd');x