repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
pi/agent/skills/optional/quickshell/bin/qs-version.mjs
Raw#!/usr/bin/env node
// qs-version.mjs: print the installed qs version and matching docs URL.
// Cross-platform: no shell, no POSIX assumptions. Pure Node builtins.
import { spawnSync } from "node:child_process";
function getVersion() {
for (const bin of ["qs", "quickshell"]) {
const r = spawnSync(bin, ["--version"], { encoding: "utf8" });
if (r.status === 0) {
// Output looks like: "Quickshell 0.3.0 (revision , distributed by Arch Linux)"
const m = r.stdout.match(/(\d+\.\d+\.\d+)/);
if (m) return m[1];
}
}
return null;
}
const version = getVersion();
if (!version) {
process.stderr.write(
"qs-version: cannot find `qs` or `quickshell` on PATH\n",
);
process.exit(1);
}
process.stdout.write(`Quickshell ${version}\n`);
process.stdout.write(`https://quickshell.org/docs/v${version}/\n`);