-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
40 lines (33 loc) · 1.06 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
const kboptions = require('./index');
const options = kboptions.parse({
info: "Demonstrates how to use kidzboptions",
version: "1.0.0",
options: {
"first-name": {
// currently supported types are "string" or "boolean"
type: "string",
// if not specified, short option is automatically generated
// from first character of long option
short: "f",
// description is optional
description: "User's first name"
},
"last-name": {
type: "string",
description: "User's last name",
// Unless specified, all options are optional
required: true
},
"dog-lover": {
// If not specified, type defaults to "boolean"
description: "User loves dogs"
},
"cat-lover": {
description: "User loves cats"
}
},
// Positional arguments can be named
positional: ["input-file", "output-file"]
});
console.log("Parsed options:", options);