npm promotes metadefinitions

    argue-cli
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.1 • Public • Published

    argue-cli

    NPM version Node version

    Node.js CLI arguments parser.

    Install

    npm i -S argue-cli
    # or 
    yarn add argue-cli

    API

    expect(...names)

    Strict expectation one of given commands. Returns full variant of expected argument.

    expect(
        {"install": "i"}, // full name and shirt name, e.g. `npm install`, `npm i` 
        ["update", "u"],  // also full name and shirt name, e.g. `npm update`, `npm u`   
        "info"            // only one variant of name
    );

    read()

    Strict reading of argument. Returns argument.

    read(); // e.g. for `npm babel` returns "babel"

    end()

    Strict expectation of end.

    end(); // e.g. for `npm babel` throws Error.

    strictOptions(flagsNames, optionsNames)

    Strict reading of flags and options. Returns fullname-value pairs object.

    strictOptions([
        ["another"],     // for flags array is same as object notation
        "verbose"        // only one variant of name, e.g. `babel --verbose`
    ], [
        {"output": "o"}, // full name and shirt name, e.g. `babel --output ./main.js`, `babel -o ./main.js` 
        ["plugins", "p"] // fullname and shirtname for array, e.g. `babel --plugins commonjs,decorators`, `babel -p commonjs,decorators` 
    ])

    strictOptionsEqual(...names)

    Strict reading of options with equal sign. If option is provided without value it will interpreted as true. Returns fullname-value pairs object.

    strictOptionsEqual(
        {"output": "o"},  // full name and shirt name, e.g. `babel --output=./main.js`, `babel -o=./main.js` 
        ["plugins", "p"], // fullname and shirtname for array, e.g. `babel --plugins=commonjs,decorators`, `babel -p=commonjs,decorators` 
        "verbose"         // only one variant of name, e.g. `babel --verbose`
    )

    options(flagsNames, optionsNames)

    Unlimited reading of flags and options. Returns fullname-value pairs object.

    options([
        ["another"],     // for flags array is same as object notation
        "verbose"        // only one variant of name, e.g. `babel compile script.js --verbose`
    ], [
        {"output": "o"}, // full name and shirt name, e.g. `babel compile script.js --output ./main.js`, `babel compile script.js -o ./main.js` 
        ["plugins", "p"] // fullname and shirtname for array, e.g. `babel --plugins commonjs,decorators compile script.js`, `babel -p commonjs,decorators compile script.js` 
    ])

    optionsEqual(...names)

    Unlimited reading of options with equal sign. If option is provided without value it will interpreted as true. Returns fullname-value pairs object.

    optionsEqual(
        {"output": "o"},  // full name and shirt name, e.g. `babel compile script.js --output=./main.js`, `babel compile script.js -o=./main.js` 
        ["plugins", "p"], // fullname and shirtname for array, e.g. `babel --plugins=commonjs,decorators compile script.js`, `babel -p=commonjs,decorators compile script.js` 
        "verbose"         // only one variant of name, e.g. `babel compile script.js --verbose`
    )

    NPM

    Install

    npm i argue-cli

    DownloadsWeekly Downloads

    32,258

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    60 kB

    Total Files

    11

    Last publish

    Collaborators

    • dangreen