1. command-line-tool
command-line-tool
command-line-tool
Package: command-line-tool
Created by: 75lb
Last modified: Mon, 13 Jun 2022 06:34:50 GMT
Version: 0.8.0
License: MIT
Downloads: 544,933
Repository: https://github.com/75lb/command-line-tool

Install

npm install command-line-tool
yarn add command-line-tool

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

Param Type Description
[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

Param Type Description
message string | 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

Param Type Description
message string | Array.<string> input message(s)

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

Stop the process with an error message.

Kind: static method of command-line-tool

Param Type Description
[err] Error the error instance
[options] object
[options.exitCode] number defaults to 1
[options.stack] boolean defaults to false

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

Parse the command-line options.

Kind: static method of command-line-tool

Param Type Description
definitions Array.<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 <[email protected]>. Documented by jsdoc-to-markdown.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin