Giter Site home page Giter Site logo

cli-usage's Introduction

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'));

cli-usage's People

Contributors

mikaelbr avatar turbo87 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.