Miss any of our Open RFC calls?Watch the recordings here! »

power-options

0.3.4 • Public • Published

power-options

CLI Option parser for NodeJS

This library contains an advanced CLI option parser for NodeJS console applications.

Installing

For the latest version:

npm install power-options

Usage

// Importing (TypeScript)
import { parseCommandLine } from "power-options";
 
// Importing (JavaScript - CommonJS)
const parseCommandLine = require("power-options").parseCommandLine;
 
// Usage
const { options, help, error, status, group } = parseCommandLine(process.argv.slice(2), {
    options: {
        "help": { shortName: "h", alias: ["?"], help: true },
        "version": { shortName: "v" },
    }
});
 
if (error) {
    console.error(error);
    if (help) {
        // print help
    }
    process.exit(status);
}
else if (help) {
    // print help
    process.exit(0);
}
else {
    // use options/group
}

Keywords

none

Install

npm i power-options

DownloadsWeekly Downloads

5

Version

0.3.4

License

Apache-2.0

Unpacked Size

246 kB

Total Files

42

Last publish

Collaborators

  • avatar