0.1.2 • Published 1 year ago

cli-api v0.1.2

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
1 year ago

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