[go: up one dir, main page]

Skip to content
/ cap Public

Simple cli arguments parser written in typescript for node/Deno

License

Notifications You must be signed in to change notification settings

MamoruDS/cap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple cli arguments parser written in typescript for node/Deno

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published