Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/yargs

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/yargs

TypeScript definitions for yargs

  • 15.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48M
decreased by-28.24%
Maintainers
1
Weekly downloads
 
Created

What is @types/yargs?

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.

What are @types/yargs's main functionalities?

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;

Other packages similar to @types/yargs

FAQs

Package last updated on 25 Feb 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc