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

0.1.2 • Public • Published

cli-api

Easily create a CLI app.

Usage

import run from "cli-api";
import * as pkg from '../package.json'
import commands from './commands'

run({
    name: "hello",
    version: pkg.version,
    argv0: pkg.name,
    commands: [
        {
            name: "world",
            alias: 'w',
            description: 'Prints "Hello World".',
            async execute(opts, args) {
                console.log(`Hello ${opts.name}`)
            },
            options: [
                {
                    name: 'name',
                    alias: 'n',
                    description: "Person you want to greet",
                    required: true,
                },
            ]
        }
    ]
})
$ hello world -n Mark
Hello Mark

/cli-api/

    Package Sidebar

    Install

    npm i cli-api

    Weekly Downloads

    8

    Version

    0.1.2

    License

    UNLICENSED

    Unpacked Size

    125 kB

    Total Files

    21

    Last publish

    Collaborators

    • mnpenner