Skip to content

trashify/print-usage

Repository files navigation

print-usage

Helpful CLI usage printer



Built with ❤︎ by Tiaan and contributors

Table of Contents

Table of Contents
  • About
  • Install
  • Usage
  • API
  • Contribute
  • License
  • About

    Simple CLI utility module for printing usage info to console or stream.

    Install

    $ npm install --save print-usage
    # OR
    $ yarn add print-usage

    Usage

    const printUsage = require('print-usage')
    
    const dummy = [
      {flags: ['--foo', '-f'], alias: '-b', description: 'Does the things', default: '55'},
      {flags: ['--bar', '--baz'], alias: '-b', description: 'Does the other things'},
      {flags: ['--baz'], description: 'Does nothing', default: 'foo'}
    ]
    
    const test = printUsage(dummy)
    test.print()
    //    --foo, -f, -b            Does the things (default: 55)
    //    --bar, --baz, -b         Does the other things
    //    --baz                    Does nothing (default: foo)

    API

    printUsage(arrayOfUsages, options)

    module exports single function that returns object with print, set & get property functions. See example.

    Contribute

    Contributions are welcome. Please open up an issue or create PR if you would like to help out.

    Note: If editing the README, please conform to the standard-readme specification.

    License

    Licensed under the MIT License.