Socket
Socket
Sign inDemoInstall

command-line-tool

Package Overview
Dependencies
12
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    command-line-tool

command-line-tool


Version published
Weekly downloads
113K
decreased by-9.9%
Maintainers
1
Install size
451 kB
Created
Weekly downloads
 

Readme

Source

view on npm npm module downloads Build Status Dependency Status js-standard-style

command-line-tool

Some conventional operations used in command-line tools.

Example

const tool = require('command-line-tool')

tool.stop([message])

Print the supplied messages then stop the process (no exit code).

Kind: static method of command-line-tool

ParamTypeDescription
[message]string | Array.<string>One or more messages to be written to stderr before exiting. May contain ansi.format markup.

tool.printError(message)

Prints one or more strings in red to stderr.

Kind: static method of command-line-tool

ParamTypeDescription
messagestring | Array.<string>input message(s)

tool.printOutput(message)

Prints one or more strings to stdout. Catches unwanted EPIPE error.

Kind: static method of command-line-tool

ParamTypeDescription
messagestring | Array.<string>input message(s)

tool.halt([err], [options])

Stop the process with an error message.

Kind: static method of command-line-tool

ParamTypeDescription
[err]Errorthe error instance
[options]object
[options.exitCode]numberdefaults to 1
[options.stack]booleandefaults to false

tool.getCli(definitions, [usageSections], [argv]) ⇒ object

Parse the command-line options.

Kind: static method of command-line-tool

ParamTypeDescription
definitionsArray.<OptionDefinitions>to be passed to command-line-args
[usageSections]Array.<section>to be passed to command-line-usage
[argv]Array.<string>If supplied, this argv array is parsed instead of process.argv.

© 2015-18 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

FAQs

Last updated on 18 Jan 2018

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