.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / minimist-options / readme.md
1 # minimist-options [![Build Status](https://travis-ci.org/vadimdemedes/minimist-options.svg?branch=master)](https://travis-ci.org/vadimdemedes/minimist-options)
2
3 > Write options for [minimist](https://npmjs.org/package/minimist) in a comfortable way.
4
5 ## Installation
6
7 ```
8 $ npm install --save minimist-options
9 ```
10
11 ## Usage
12
13 ```js
14 const buildOptions = require('minimist-options');
15 const minimist = require('minimist');
16
17 const options = buildOptions({
18         name: {
19                 type: 'string',
20                 alias: 'n',
21                 default: 'john'
22         },
23
24         force: {
25                 type: 'boolean',
26                 alias: ['f', 'o'],
27                 default: false
28         },
29
30         published: 'boolean',
31
32         // special option for positional arguments (`_` in minimist)
33         arguments: 'string'
34 });
35
36 const args = minimist(options);
37 ```
38
39 instead of:
40
41 ```js
42 const minimist = require('minimist');
43
44 const options = {
45         string: ['name', '_'],
46         boolean: ['force', 'published'],
47         alias: {
48                 n: 'name',
49                 f: 'force',
50                 o: 'force'
51         },
52         default: {
53                 name: 'john',
54                 f: false
55         }
56 };
57
58 const args = minimist(options);
59 ```
60
61 ## License
62
63 MIT © [Vadim Demedes](https://vadimdemedes.com)