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

    1.2.1 • Public • Published

    Yet another command line parser. This one supports subcommands though.

    Usage

    const parseCommandLine = require("yaclip");
     
    const subcommands = [
        { name: 'subcommand', alias: "s", type: String, multiple: false},
    ]
     
    const commands = [
        { name: 'command', alias: "c", type: String, multiple: false, subcommands},
        { name: 'other', alias: "0", type: String, multiple: false}
    ];
     
    const arguments = parseCommandLine(commands);
    console.log(arguments);
    node example.js \
        --command "This is the command" \
        --subcommand "this goes in the subsection of command" \
        --other "this is parsed nicely"

    It has limitations, I built it for bounce.

    Dash optionality

    If you prefer your commands without dashes, specify option dashesAreOptional to true when instantiating the parser:

    const arguments = parseCommandLine(commands, { dashesAreOptional: true });
    console.log(arguments);
    node example.js \
        command "This is the command" \
        --subcommand "this goes in the subsection of command" \
        other "this is parsed nicely"

    Install

    npm i yaclip

    DownloadsWeekly Downloads

    12

    Version

    1.2.1

    License

    ISC

    Unpacked Size

    11.6 kB

    Total Files

    7

    Last publish

    Collaborators

    • cfe84