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

command-line-tool

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command-line-tool

command-line-tool

  • 0.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
115K
decreased by-38.37%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 18 Jan 2018

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