Basic list of installed software

This commit is contained in:
ziajka
2019-01-09 13:45:37 +01:00
parent 77a47e8fd2
commit c1b76d8d4d
7 changed files with 79 additions and 25 deletions

20
installed-software.js Normal file
View File

@ -0,0 +1,20 @@
var commandExistsSync = require('command-exists').sync;
exports.getInstalledSoftware = (softwareList) => {
const installed = {};
for(var software of softwareList) {
var name = software.name;
var commands = software.commands;
installed[name] = [];
for(var command of commands) {
var exists = commandExistsSync(command);
if(exists) {
installed[name].push(command);
}
}
}
return installed;
}