Socket
Socket
Sign inDemoInstall

@types/command-line-usage

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/command-line-usage


Version published
Maintainers
1
Install size
7.91 kB
Created

Package description

What is @types/command-line-usage?

@types/command-line-usage provides TypeScript type definitions for the command-line-usage package, which is used to create usage guides for command-line applications. It helps in defining sections, options, and examples to display a well-structured help message.

What are @types/command-line-usage's main functionalities?

Defining Sections

This feature allows you to define different sections of the usage guide, such as headers and content. The code sample demonstrates how to create sections for a command-line application, including a header and options.

const commandLineUsage = require('command-line-usage');

const sections = [
  {
    header: 'My App',
    content: 'A brief description of my app.'
  },
  {
    header: 'Options',
    optionList: [
      {
        name: 'help',
        typeLabel: '{underline boolean}',
        description: 'Display this usage guide.'
      },
      {
        name: 'src',
        typeLabel: '{underline file}',
        description: 'The input files to process.'
      }
    ]
  }
];

const usage = commandLineUsage(sections);
console.log(usage);

Displaying Examples

This feature allows you to include examples in the usage guide. The code sample shows how to add an example section to the usage guide, demonstrating how to run the command-line application with specific options.

const commandLineUsage = require('command-line-usage');

const sections = [
  {
    header: 'Example',
    content: 'node myapp.js --src file.txt'
  }
];

const usage = commandLineUsage(sections);
console.log(usage);

Customizing Option Descriptions

This feature allows you to customize the descriptions and type labels for options. The code sample demonstrates how to define options with custom descriptions and type labels, providing more detailed information to the user.

const commandLineUsage = require('command-line-usage');

const sections = [
  {
    header: 'Options',
    optionList: [
      {
        name: 'verbose',
        description: 'Enable verbose mode.'
      },
      {
        name: 'timeout',
        typeLabel: '{underline ms}',
        description: 'Timeout value in milliseconds.'
      }
    ]
  }
];

const usage = commandLineUsage(sections);
console.log(usage);

Other packages similar to @types/command-line-usage

Readme

Source

Installation

npm install --save @types/command-line-usage

Summary

This package contains type definitions for command-line-usage (https://github.com/75lb/command-line-usage#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/command-line-usage.

Additional Details

  • Last updated: Tue, 06 Jul 2021 18:05:57 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by matrumz, and Andrija Dvorski.

FAQs

Last updated on 06 Jul 2021

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc