@mamoruds/cap
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

cap

Simple cli arguments parser written in TypesScript for node/Deno

npm

Installation

nodejs

npm i @mamoruds/cap

Deno

import { Cap } from 'https://deno.land/x/cap/cap-deno.ts'

Usage

import { Cap } from '@mamoruds/cap'

const cap = new Cap({
    name: {
        alias: 'n',
        type: 'string',
        optional: false,
        about: 'some description about field "name"',
    },
    age: {
        type: 'string',
        optional: true,
        about: 'some description about field "age"',
    },
    silent: {
        alias: 's',
        type: 'boolean',
        optional: true,
        default: true,
        about: 'enable/disable silent',
    },
})
    .about('cap-js-example-node')
    .parse(process.argv.slice(2))

console.log(cap)

// $ node script.js -n mamoru --no-silent
// or using Deno
// $ deno run script.js -n mamoru --no-silent
// output
// { name: 'mamoru', silent: false, age: undefined }

License

MIT © MamoruDS

Package Sidebar

Install

npm i @mamoruds/cap

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

37.9 kB

Total Files

18

Last publish

Collaborators

  • mamoruds