https://github.com/mamoruds/cap
Simple cli arguments parser written in typescript for node/Deno
https://github.com/mamoruds/cap
argument-parser command-line-parser
Last synced: 10 months ago
JSON representation
Simple cli arguments parser written in typescript for node/Deno
- Host: GitHub
- URL: https://github.com/mamoruds/cap
- Owner: MamoruDS
- License: mit
- Created: 2021-01-17T12:11:21.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-17T18:11:06.000Z (over 5 years ago)
- Last Synced: 2025-09-14T23:17:36.313Z (10 months ago)
- Topics: argument-parser, command-line-parser
- Language: TypeScript
- Homepage:
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cap
Simple cli arguments parser written in TypesScript for node/Deno
[](https://www.npmjs.com/package/@mamoruds/cap)
## Installation
### nodejs
```shell
npm i @mamoruds/cap
```
### Deno
```typescript
import { Cap } from 'https://deno.land/x/cap/cap-deno.ts'
```
## Usage
```typescript
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