2022-09-02 17:51:31 +03:00
|
|
|
#!/usr/bin/env -S tea -E
|
|
|
|
|
|
|
|
/*---
|
|
|
|
args:
|
|
|
|
- deno
|
|
|
|
- run
|
|
|
|
- --allow-read
|
|
|
|
- --allow-env
|
|
|
|
- --import-map={{ srcroot }}/import-map.json
|
|
|
|
---*/
|
|
|
|
|
2022-09-21 10:46:24 +03:00
|
|
|
import { pkg as pkgutils } from "utils"
|
2022-09-20 14:53:40 +03:00
|
|
|
import { useCellar, useFlags } from "hooks"
|
2022-09-02 17:51:31 +03:00
|
|
|
|
|
|
|
useFlags()
|
|
|
|
|
|
|
|
/// filters out everything that is already installed
|
|
|
|
|
|
|
|
const cellar = useCellar()
|
|
|
|
const desired_filter = !!Deno.env.get("INVERT")
|
|
|
|
|
|
|
|
const rv: string[] = []
|
2022-09-21 10:46:24 +03:00
|
|
|
for (const pkg of Deno.args.map(pkgutils.parse)) {
|
|
|
|
const isInstalled = !!await cellar.has(pkg)
|
2022-09-02 17:51:31 +03:00
|
|
|
if (isInstalled == desired_filter) {
|
|
|
|
rv.push(pkg.project)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Deno.env.get("GITHUB_ACTIONS")) {
|
|
|
|
console.log(`::set-output name=pkgs::${rv.join(" ")}\n`)
|
|
|
|
} else {
|
|
|
|
console.log(rv.join("\n"))
|
|
|
|
}
|