
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
shell-command-builder
Advanced tools
Construct and execute shell commands
Install:
yarn add shell-command-builder
# OR
npm install shell-command-builder
Require or import the module:
const { CommandBuilder, run, interactive } = require("shell-command-builder");
// OR
import { CommandBuilder, run, interactive } from "shell-command-builder";
Build shell commands with arguments:
const command = new CommandBuilder("foo", [
"file.text",
"--flag-1",
"--flag-2",
"-a",
]); //=> foo file.text --flag-1 --flag-2 -a
Convert command to a string:
String(command);
command.toString();
`command = ${command}`;
Use fluent API to add args/flags after initial command is created:
const command = new CommandBuilder("foo");
command.arg("--hello");
console.log(command); //=> foo --hello
Pass in a truthy/falsy condition to optionally add args/flags:
const command = new CommandBuilder("foo");
const options = {
watch: true,
quiet: false,
};
command.arg("--watch", options.watch); // added
command.arg("--quiet", options.quiet); // not added
console.log(command); //=> foo --watch
Run commands:
const command = new CommandBuilder("echo 'hello, world!'");
const { stdout } = await command.run(); //=> hello, world!
// OR
const { stdout } = await run(command); //=> hello, world!
// OR
await command.interactive(); //=[shell]=> hello, world!
// OR
await interactive(command); //=[shell]=> hello, world!
FAQs
Construct and execute shell commands
We found that shell-command-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.