@hyrious/bun.lockb
Version:
Parse and print bun.lockb
27 lines (25 loc) • 782 B
JavaScript
// src/lockb-cli.ts
import { readFileSync } from "node:fs";
import { parse } from "./lockb.js";
if (process.argv[2] === "-h" || process.argv[2] === "--help") {
console.log();
console.log(" Description");
console.log(" Parse and print bun.lockb in text format");
console.log();
console.log(" Usage");
console.log(" $ npx @hyrious/lockb [bun.lockb]");
console.log();
process.exit(0);
}
if (process.argv[2]?.toLowerCase() === "-v") {
const pkg = JSON.parse(
readFileSync(new URL("../package.json", import.meta.url), "utf8")
);
console.log(`${pkg.name}, ${pkg.version}`);
process.exit(0);
}
var file = process.argv[2] || "bun.lockb";
var buffer = readFileSync(file);
var lockfile = parse(buffer);
process.stdout.write(lockfile);