Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Some simple CLI scaffolding for promise returning applications.
require('@iarna/cli')(main)
.boolean('silent')
.boolean('exit')
.version()
.help()
function main (opts, arg1, arg2, arg3) {
if (!opts.silent) console.error('Starting up!')
console.log('Got:', arg1, arg2, arg3)
if (opts.error) throw new Error('throw')
return new Promise(resolve => setTimeout(resolve, 10000))
}
yargs
- The wrapper around the main function returns a yargs object, so
you can configure it as usual. The argv
object is passed in as the
first argument of your entry point function. The rest of your positional
arguments are passed in as the remaining function arguments.update-notifier
- A default update notifier is setup for your app so
users will learn about new versions when you publish them. Your app needs to
have a name, version and bin entry in its package.json
. (The bin entry
needs to have the script using @iarna/cli
in it for the update notifier
to trigger.).stack
) else with the rejected value
and your process will exit with an error code.A full framework for writing cli apps. You'll likely outgrow the error handling pretty fast if this is anything beyond a little one off. This mostly exists to scratch my own itch. I kept on writing this code and I wanted to stop. =D
The module itself returns a function that you need to call with the name of your main function. This is the top level function of your program that should return a promise, that when resolved indicates that your program is complete.
Your entry point function should look like this:
main(opts, arg1, arg2, …, argn) → Promise
The first opts
argument is yargs.argv
and the additional arguments are
from argv._
, so arg1 === argv._[0]
, arg2 === argv._[1]
and so on.
FAQs
Some simple CLI scaffolding for promise returning applications.
The npm package @iarna/cli receives a total of 68,953 weekly downloads. As such, @iarna/cli popularity was classified as popular.
We found that @iarna/cli 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.