Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexbinary/tinyclap
a tiny command line argument parser for Node.js
https://github.com/alexbinary/tinyclap
Last synced: 1 day ago
JSON representation
a tiny command line argument parser for Node.js
- Host: GitHub
- URL: https://github.com/alexbinary/tinyclap
- Owner: alexbinary
- Created: 2015-03-01T10:40:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-01T10:44:07.000Z (over 9 years ago)
- Last Synced: 2024-04-26T17:20:26.278Z (7 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tinyclap - A tiny command line arguments parser for Node.js
```
npm install tinyclap
```Example program :
```javascript
var clap = require('tinyclap')();
console.log(clap);
```Input :
```
node index.js command
-a
-b42
-c=88
-d 21
-ef
-gh5
-foo=bar
--mn6
--opt1 value1
--opt2=value2
--opt3="value with spaces"
--long-option-with-dashes
--long-option-with-value1=10
--long-option-with-value2 20
otherthing
```Output :
```
{ node: '/usr/bin/node',
file: '/home/john/index.js',
cmd: 'command'
argv:
{ '5': true,
a: true,
b: 42,
c: '88',
d: '21',
e: true,
f: true,
g: true,
h: true,
foo: 'bar',
mn6: true,
opt1: 'value1',
opt2: 'value2',
opt3: 'value with spaces',
'long-option-with-dashes': true,
'long-option-with-value1': '10',
'long-option-with-value2': '20' },
argn:
[ 'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'5',
'foo',
'mn6',
'opt1',
'opt2',
'opt3',
'long-option-with-dashes',
'long-option-with-value1',
'long-option-with-value2',
'otherthing' ],
}
```# Contact
Alexandre Bintz
Comments and suggestions are welcome.