-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
80 lines (70 loc) · 1.53 KB
/
cli.js
File metadata and controls
80 lines (70 loc) · 1.53 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env node
'use strict';
const init = require('init-editorconfig');
const meow = require('meow');
const feedback = require('@abranhe/feedback')
const cli = meow(`
Usage
$ init-editorconfig <option>
Options
--help Show this message and close
--feedback, -f Send a feedback
--root, -r Special property that should be specified at the top
of the file
--match, -m Set special characters to be recognized for EditorConfig
--also, -a Leave black space between properties
--property, -p Set a new property
--value, -v Set value for property
Example
$ init-editorconfig --root true -m "*.py" -p indent_style -v space
`,{
flags: {
feedback: {
type: 'boolean',
alias: 'f'
},
root: {
type: 'string',
alias: 'r'
},
match: {
type: 'string',
alias: 'm'
},
property: {
type: 'string',
alias: 'p'
},
value: {
type: 'string',
alias: 'v'
},
also: {
type: 'boolean',
alias: 'a'
},
help: {
type: 'boolean',
alias: 'h'
}
}
});
if(cli.flags.feedback) {
feedback.project('init-editorconfig');
feedback.description('Please specify if the issue is with the API project or the CLI');
feedback.message(feedback.defaultMessage);
feedback.web();
}
if(cli.flags.also) {
init.also();
}
if(cli.flags.root) {
init.root(cli.flags.root);
}
if(cli.flags.match) {
init.match(cli.flags.match);
}
if(cli.flags.property && cli.flags.value) {
init.property(cli.flags.property, cli.flags.value);
}
init.build();