diff --git a/ScoopCompare/ScoopCompare.js b/ScoopCompare/ScoopCompare.js new file mode 100644 index 0000000..691cafc --- /dev/null +++ b/ScoopCompare/ScoopCompare.js @@ -0,0 +1,26 @@ +// Run with node + +// Read ~/scoop/apps.json and compare it to scoop export +// Then display the differences in the installed apps and the apps.json file + +// read apps.json file +let fs = require('fs'); +let apps = fs.readFileSync('C:/Users/Isaac/scoop/apps.json', 'utf8'); +apps = JSON.parse(apps); +apps = apps.apps; + +// run scoop export in shell and save output to variable +let { execSync } = require('child_process'); +let installedApps = execSync('scoop export').toString(); +installedApps = JSON.parse(installedApps); +installedApps = installedApps.apps; + +// Make a set out of each of the arrays on the Name property +let appsSet = new Set(apps.map(app => app.Name)); +let installedAppsSet = new Set(installedApps.map(app => app.Name)); + +// Find the difference between the two sets +let diffFromInstalledApps = new Set([...appsSet].filter(x => !installedAppsSet.has(x))); +let diffFromApps = new Set([...installedAppsSet].filter(x => !appsSet.has(x))); +console.log("Apps in apps.json but not installed: ", diffFromInstalledApps); +console.log("Apps installed but not in apps.json: ", diffFromApps); \ No newline at end of file diff --git a/scoop-pkg/scoop_pkg.ps1 b/scoop-pkg/scoop_pkg.ps1 deleted file mode 100644 index 6085077..0000000 --- a/scoop-pkg/scoop_pkg.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -if ($args[0] -eq "freeze") { - if (!$args[1]) { - scoop export | Out-File -Encoding utf8 -FilePath $env:HOMEPATH\scoop_pkg.json - } else { - scoop export | Out-File -Encoding utf8 -FilePath $args[1] - } -} else { - if (!$args[0]) { - scoop import $env:HOMEPATH\scoop_pkg.json - } else { - scoop import $args[0] - } -} \ No newline at end of file