Have ideas to improve npm?Join in the discussion! »

    meow-shorts
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    meow-shorts

    License XO code style

    This library is a wrapper for the faboulous meow that enables a few shortcuts:

    • -h for --help
    • -v for --version

    Basically this library calls showHelp() and showVersion() when the command arguments contain either '-h' or '-v' respectively.

    This is a module built ad-hoc for meow, so this is the reason why meow is a peer dependency for this project.

    Install

    npm

    $ npm install meow meow-shorts
    

    yarn

    $ yarn add meow meow-shorts
    

    Usage

    #!/usr/bin/env node
     
    const meow = require('meow');
    const meowShorts = require('meow-shorts');
     
    const cli = meow(`
        Usage
          $ foo <input>
     
        Options
          --rainbow, -r  Include a rainbow
     
        Examples
          $ foo unicorns --rainbow
          🌈 unicorns 🌈
    `, {
        flags: {
            rainbow: {
                type: 'boolean',
                alias: 'r'
            }
        }
    });
     
    meowShorts(cli);
     
    // Regular usage

    API

    meowShorts(cli, [options])

    Wraps the object returned handling help and version shortcuts.

    cli

    Type: meow.Result

    The object returned from meow(...) invocation.

    options

    Type: Object

    enableHelpShortcut

    Type: boolean
    Default: true

    Explicitly disable the '-h' shortcut to the 'help' command.

    enableVersionShortcut

    Type: boolean
    Default: true

    Explicitly disable the '-v' shortcut to the 'version' command.

    helpShortcutExitCode

    Type: number
    Default: undefined

    Set a custom exit code for the 'help' command. If you don't override this, this module reverts to the default meow exit code (which is 2).

    License

    MIT © Nicola Dal Maso

    Install

    npm i meow-shorts

    DownloadsWeekly Downloads

    4

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    6.77 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar