Socket
Socket
Sign inDemoInstall

cli-usage

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-usage

Easily show CLI usage from a markdown source file


Version published
Weekly downloads
43K
decreased by-11.41%
Maintainers
1
Weekly downloads
 
Created
Source

cli-usage

Easily show the usage of your CLI tool from a Markdown string or file. You can just plug cli-usage in without thinking about paramters, or you can handle that your self using the .get API end-point.

Install

npm install cli-usage

Usage

Most basic usage, just plug in:

var usage = require('cli-usage');
usage();
//=> If help-flag is passed, print usage
//=> and exit with code 0.

This will listen for -h, -help or --help passed into your CLI and try to locate a usage.md file from the directory of the file. If help is passed and the usage.md file found, the usage will be printed and the application will exit with code 0.

You can also pass in a filename or a string.

var usage = require('cli-usage');
usage('./some/path/to/usage.md');

or

var usage = require('cli-usage');
usage('# Simple usage');

Get compiled usage

Instead of cli-usage doing all the work, you can also just retrieve the compiled usage text and handle it your self.

Example
var usage = require('cli-usage');

console.log(usage.get('# some custom markdown from string'));

console.log(usage.get('./usage.md'));

Keywords

FAQs

Package last updated on 23 Sep 2019

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