
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.
A javascript implementation of google/python-fire
js-fire is a library for automatically generating command line interfaces (CLIs) from most js objects.
yarn add js-fire
npm install js-fire
js-fire is exposed as both an API and a CLI.
You can call Fire on any functions and objects:
Here's an example of calling Fire on a object, you can infinitely nest objects to create subcommands.
const fire = require('js-fire')
const calculator = {
__description__: 'I am a math machine',
double: number => {
// I double things
return 2 * number
},
add: (n1 = Math.PI, n2) => {
return n1 + n2
},
misc: {
year: () => '1999',
brand: () => 'casio',
hello: name => `hello ${name}`,
},
}
fire(calculator)
Then, from the command line, you can run:
node calculator.js double --number=15 # 30
node calculator.js misc hello hobochild # 'hello hobochild'
Automactic --help command.
node calculator.js --help
USAGE:
node calculator.js
DESCRIPTION:
I am a math machine
COMMANDS:
half --number=<number>
double --number=<number>
add --n1=3.141592653589793 --n2=<n2>
misc
year
brand
hello --name=<name>
Automatic --interactive mode:
For additional examples, see /examples.
js-fire exposes a CLI that takes modulePath and passes it to js-fire.
USAGE:
js-fire --modulePath=<modulePath>
So you can js-fire on most js modules.
js-fire fs -- writeFileSync --path=hello.txt --data="hiii"
You can also use interactive and help mode to explore a modules api:
js-fire fs -- -h
USAGE:
js-fire
COMMANDS:
appendFile <flags> --path=<path> --data=<data> --options=<options> --callback=<callback>
appendFileSync <flags> --path=<path> --data=<data> --options=<options>
access <flags> --path=<path> --mode=<mode> --callback=<callback>
accessSync <flags> --path=<path> --mode=<mode>
chown <flags> --path=<path> --uid=<uid> --gid=<gid> --callback=<callback>
chownSync <flags> --path=<path> --uid=<uid> --gid=<gid>
chmod <flags> --path=<path> --mode=<mode> --callback=<callback>
chmodSync <flags> --path=<path> --mode=<mode>
close <flags> --fd=<fd> --callback=<callback>
closeSync <flags> --fd=<fd>
copyFile <flags> --src=<src> --dest=<dest> --flags=<flags> --callback=<callback>
copyFileSync <flags> --src=<src> --dest=<dest> --flags=<flags>
createReadStream <flags> --path=<path> --options=<options>
createWriteStream <flags> --path=<path> --options=<options>
exists <flags> --path=<path> --callback=<callback>
existsSync <flags> --path=<path>
...
FAQs
github.com/google/python-fire clone for node.js
The npm package js-fire receives a total of 411 weekly downloads. As such, js-fire popularity was classified as not popular.
We found that js-fire 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.