mirror of
https://github.com/nadimkobeissi/mkbsd.git
synced 2024-12-23 02:05:16 +00:00
37 lines
862 B
JavaScript
Executable File
37 lines
862 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
const path = require("path");
|
|
const { spawn } = require("child_process");
|
|
const yargs = require("yargs/yargs");
|
|
const { hideBin } = require("yargs/helpers");
|
|
|
|
const argv = yargs(hideBin(process.argv))
|
|
.option("path", {
|
|
alias: "p",
|
|
type: "string",
|
|
description: "Path to save downloads",
|
|
default: process.cwd(),
|
|
})
|
|
.help().argv;
|
|
|
|
// Path to the original mkbsd.js script
|
|
const scriptPath = path.join(__dirname, "mkbsd.js");
|
|
|
|
// Set the working directory to the specified path
|
|
process.chdir(argv.path);
|
|
|
|
// Run the original script
|
|
const child = spawn("node", [scriptPath], {
|
|
stdio: "inherit",
|
|
env: { ...process.env, DOWNLOAD_PATH: argv.path },
|
|
});
|
|
|
|
child.on("error", (error) => {
|
|
console.error(`Error running script: ${error.message}`);
|
|
process.exit(1);
|
|
});
|
|
|
|
child.on("close", (code) => {
|
|
process.exit(code);
|
|
});
|