Socket
Socket
Sign inDemoInstall

@types/yargs

Package Overview
Dependencies
1
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/yargs

TypeScript definitions for yargs


Version published
Weekly downloads
64M
increased by3.27%
Maintainers
1
Install size
67.2 kB
Created
Weekly downloads
 

Package description

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

Readme

Source

Installation

npm install --save @types/yargs

Summary

This package contains type definitions for yargs (https://github.com/chevex/yargs).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs.

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/yargs-parser

Credits

These definitions were written by Martin Poelstra, Mizunashi Mana, Jeffery Grajkowski, Jimi (Dimitris) Charalampidis, Steffen Viken Valvåg, Emily Marigold Klassen, ExE Boss, Aankhen, and Ben Coe.

FAQs

Last updated on 21 Nov 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc