Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@types/yargs
Advanced tools
The @types/yargs package provides TypeScript type definitions for the yargs library, which is a tool to help build interactive command line tools, by parsing arguments and generating an elegant user interface. It helps TypeScript developers to have auto-completion and type checking when using yargs.
Command Module Definition
Defines a command with options. This example creates a 'get' command with a required 'url' option.
import * as yargs from 'yargs';
yargs.command('get', 'make a get HTTP request', {
url: {
describe: 'URL to make request to',
demand: true,
alias: 'u',
type: 'string'
}
}, (argv) => {
console.log(`Making a GET request to: ${argv.url}`);
});
Option Parsing
Parses command line options. This example parses a boolean 'verbose' option.
import * as yargs from 'yargs';
const argv = yargs.option('verbose', {
alias: 'v',
type: 'boolean',
description: 'Run with verbose logging'
}).argv;
if (argv.verbose) console.log('Verbose mode on');
Help and Version Setup
Sets up automatic version and help message support. This example sets the version of the CLI tool and enables the default help support.
import * as yargs from 'yargs';
yargs.version('1.0.0').help().argv;
Commander is another popular npm package for building command line interfaces. It offers a high-level API for creating commands and options, similar to yargs. Commander is known for its simplicity and ease of use, but yargs provides more detailed control over argument parsing and generates more comprehensive help messages automatically.
Meow is a lighter alternative to yargs for building CLI tools. It focuses on simplicity and minimal configuration. While it is easier to set up for simple scripts, yargs offers more advanced features like command-specific options, middleware, and automatic help generation.
npm install --save @types/yargs
This package contains type definitions for yargs (https://github.com/chevex/yargs).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
Additional Details
These definitions were written by Martin Poelstra https://github.com/poelstra, Mizunashi Mana https://github.com/mizunashi-mana, Jeffery Grajkowski https://github.com/pushplay, Jeff Kenney https://github.com/jeffkenney, Jimi (Dimitris) Charalampidis https://github.com/JimiC, Steffen Viken Valvåg https://github.com/steffenvv.
FAQs
TypeScript definitions for yargs
The npm package @types/yargs receives a total of 55,385,819 weekly downloads. As such, @types/yargs popularity was classified as popular.
We found that @types/yargs demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.