argue-cli 1.1.0 → 2.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -5
- package/README.md +150 -66
- package/dist/args.d.ts +17 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/argv.d.ts +14 -0
- package/dist/argv.d.ts.map +1 -0
- package/dist/core.d.ts +19 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/index.cjs +208 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +195 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +9 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +24 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +33 -29
- package/.npmignore +0 -37
- package/.travis.yml +0 -12
- package/lib/lib.js +0 -416
- package/src/lib.js +0 -393
- package/test/end.js +0 -18
- package/test/expect.js +0 -59
- package/test/mocha.opts +0 -2
- package/test/options-equal.js +0 -172
- package/test/options.js +0 -349
- package/test/read.js +0 -25
- package/test/strict-options-equal.js +0 -132
- package/test/strict-options.js +0 -269
package/test/options.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import * as Argue from '../src/lib';
|
|
2
|
-
|
|
3
|
-
describe("options()", () => {
|
|
4
|
-
|
|
5
|
-
describe("when flag", () => {
|
|
6
|
-
|
|
7
|
-
describe("described as string", () => {
|
|
8
|
-
|
|
9
|
-
it('should throw error when given flag is doesn\'t expected', () => {
|
|
10
|
-
|
|
11
|
-
Argue.setArguments('--verbose');
|
|
12
|
-
(() => Argue.options(["silent"], [])).should.throw(Error, {
|
|
13
|
-
message: 'Unexpected key "verbose".'
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('should return empty object when no more arguments', () => {
|
|
18
|
-
|
|
19
|
-
Argue.setArguments();
|
|
20
|
-
Argue.options(["verbose"], []).should.be.deepEqual({});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should return empty object when key given instead flag', () => {
|
|
24
|
-
|
|
25
|
-
Argue.setArguments('install');
|
|
26
|
-
Argue.options(["verbose"], []).should.be.deepEqual({});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should return object with values', () => {
|
|
30
|
-
|
|
31
|
-
Argue.setArguments('--verbose');
|
|
32
|
-
Argue.options(["verbose"], []).should.be.deepEqual({
|
|
33
|
-
verbose: true
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should read all flags and return object with values', () => {
|
|
38
|
-
|
|
39
|
-
Argue.setArguments('lift', '--verbose');
|
|
40
|
-
Argue.options(["verbose"], []).should.be.deepEqual({
|
|
41
|
-
verbose: true
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe("described as array", () => {
|
|
47
|
-
|
|
48
|
-
it('should throw error when given flag is doesn\'t expected', () => {
|
|
49
|
-
|
|
50
|
-
Argue.setArguments('--verbose');
|
|
51
|
-
(() => Argue.options([["silent", "s"]], [])).should.throw(Error, {
|
|
52
|
-
message: 'Unexpected key "verbose".'
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should return empty object when no more arguments', () => {
|
|
57
|
-
|
|
58
|
-
Argue.setArguments();
|
|
59
|
-
Argue.options([["verbose", "v"]], []).should.be.deepEqual({});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
it('should return empty object when key given instead flag', () => {
|
|
64
|
-
|
|
65
|
-
Argue.setArguments('install');
|
|
66
|
-
Argue.options([["verbose", "v"]], []).should.be.deepEqual({});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should return object with values if full flag is given', () => {
|
|
70
|
-
|
|
71
|
-
Argue.setArguments('--verbose');
|
|
72
|
-
Argue.options([["verbose", "v"]], []).should.be.deepEqual({
|
|
73
|
-
verbose: true
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should read all flags and return object with values if full flag is given', () => {
|
|
78
|
-
|
|
79
|
-
Argue.setArguments('lift', '--verbose');
|
|
80
|
-
Argue.options([["verbose", "v"]], []).should.be.deepEqual({
|
|
81
|
-
verbose: true
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should return object with values if shirt flag is given', () => {
|
|
86
|
-
|
|
87
|
-
Argue.setArguments('-v');
|
|
88
|
-
Argue.options([["verbose", "v"]], []).should.be.deepEqual({
|
|
89
|
-
verbose: true
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should read all flags and return object with values if shirt flag is given', () => {
|
|
94
|
-
|
|
95
|
-
Argue.setArguments('lift', '-v');
|
|
96
|
-
Argue.options([["verbose", "v"]], []).should.be.deepEqual({
|
|
97
|
-
verbose: true
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe("described as object", () => {
|
|
103
|
-
|
|
104
|
-
it('should throw error when given flag is doesn\'t expected', () => {
|
|
105
|
-
|
|
106
|
-
Argue.setArguments('--verbose');
|
|
107
|
-
(() => Argue.options([{"silent": "s"}], [])).should.throw(Error, {
|
|
108
|
-
message: 'Unexpected key "verbose".'
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should return empty object when no more arguments', () => {
|
|
113
|
-
|
|
114
|
-
Argue.setArguments();
|
|
115
|
-
Argue.options([{"verbose": "v"}], []).should.be.deepEqual({});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('should return empty object when key given instead flag', () => {
|
|
119
|
-
|
|
120
|
-
Argue.setArguments('install');
|
|
121
|
-
Argue.options([{"verbose": "v"}], []).should.be.deepEqual({});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('should return object with values if full flag is given', () => {
|
|
125
|
-
|
|
126
|
-
Argue.setArguments('--verbose');
|
|
127
|
-
Argue.options([{"verbose": "v"}], []).should.be.deepEqual({
|
|
128
|
-
verbose: true
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('should read all flags and return object with values if full flag is given', () => {
|
|
133
|
-
|
|
134
|
-
Argue.setArguments('lift', '--verbose');
|
|
135
|
-
Argue.options([{"verbose": "v"}], []).should.be.deepEqual({
|
|
136
|
-
verbose: true
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('should return object with values if shirt flag is given', () => {
|
|
141
|
-
|
|
142
|
-
Argue.setArguments('-v');
|
|
143
|
-
Argue.options([{"verbose": "v"}], []).should.be.deepEqual({
|
|
144
|
-
verbose: true
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should read all flags and return object with values if shirt flag is given', () => {
|
|
149
|
-
|
|
150
|
-
Argue.setArguments('lift', '-v');
|
|
151
|
-
Argue.options([{"verbose": "v"}], []).should.be.deepEqual({
|
|
152
|
-
verbose: true
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
describe("when option", () => {
|
|
159
|
-
|
|
160
|
-
describe("described as string", () => {
|
|
161
|
-
|
|
162
|
-
it('should throw error when given option is doesn\'t expected', () => {
|
|
163
|
-
|
|
164
|
-
Argue.setArguments('--input');
|
|
165
|
-
(() => Argue.options([], ["output"])).should.throw(Error, {
|
|
166
|
-
message: 'Unexpected key "input".'
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('should throw error when value of option is skiped', () => {
|
|
171
|
-
|
|
172
|
-
Argue.setArguments('--output');
|
|
173
|
-
(() => Argue.options([], ["output"])).should.throw(Error, {
|
|
174
|
-
message: "Unexpected end of arguments."
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('should return empty object when no more arguments', () => {
|
|
179
|
-
|
|
180
|
-
Argue.setArguments();
|
|
181
|
-
Argue.options([], ["output"]).should.be.deepEqual({});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('should return empty object when key given instead flag', () => {
|
|
185
|
-
|
|
186
|
-
Argue.setArguments('install');
|
|
187
|
-
Argue.options([], ["output"]).should.be.deepEqual({});
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('should return object with values', () => {
|
|
191
|
-
|
|
192
|
-
Argue.setArguments('--output', '/var/tmp.txt');
|
|
193
|
-
Argue.options([], ["output"]).should.be.deepEqual({
|
|
194
|
-
output: '/var/tmp.txt'
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('should read all options and return object with values', () => {
|
|
199
|
-
|
|
200
|
-
Argue.setArguments('compile', '--output', '/var/tmp.txt', 'myApp');
|
|
201
|
-
Argue.options([], ["output"]).should.be.deepEqual({
|
|
202
|
-
output: '/var/tmp.txt'
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
describe("described as array", () => {
|
|
208
|
-
|
|
209
|
-
it('should throw error when given option is doesn\'t expected', () => {
|
|
210
|
-
|
|
211
|
-
Argue.setArguments('--input');
|
|
212
|
-
(() => Argue.options([], [["output", "o"]])).should.throw(Error, {
|
|
213
|
-
message: 'Unexpected key "input".'
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('should throw error when value of option is skiped', () => {
|
|
218
|
-
|
|
219
|
-
Argue.setArguments('--output');
|
|
220
|
-
(() => Argue.options([], [["output", "o"]])).should.throw(Error, {
|
|
221
|
-
message: "Unexpected end of arguments."
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it('should return empty object when no more arguments', () => {
|
|
226
|
-
|
|
227
|
-
Argue.setArguments();
|
|
228
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({});
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it('should return empty object when key given instead flag', () => {
|
|
232
|
-
|
|
233
|
-
Argue.setArguments('install');
|
|
234
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('should return object with values if full flag is given', () => {
|
|
238
|
-
|
|
239
|
-
Argue.setArguments('--output', '/var/tmp.txt');
|
|
240
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({
|
|
241
|
-
output: ['/var/tmp.txt']
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('should return object with array values if shirt flag is given', () => {
|
|
246
|
-
|
|
247
|
-
Argue.setArguments('--output', '/var/tmp.txt,/var/log/my');
|
|
248
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({
|
|
249
|
-
output: ['/var/tmp.txt', '/var/log/my']
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it('should return object with values if shirt flag is given', () => {
|
|
254
|
-
|
|
255
|
-
Argue.setArguments('-o', '/var/tmp.txt');
|
|
256
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({
|
|
257
|
-
output: ['/var/tmp.txt']
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it('should read all options and return object with values if shirt flag is given', () => {
|
|
262
|
-
|
|
263
|
-
Argue.setArguments('compile', '--output', '/var/tmp.txt,/var/log/my', 'myApp');
|
|
264
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({
|
|
265
|
-
output: ['/var/tmp.txt', '/var/log/my']
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('should return object with array values if shirt flag is given', () => {
|
|
270
|
-
|
|
271
|
-
Argue.setArguments('-o', '/var/tmp.txt,/var/log/my');
|
|
272
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({
|
|
273
|
-
output: ['/var/tmp.txt', '/var/log/my']
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
it('should read all options and return object with values if shirt flag is given', () => {
|
|
278
|
-
|
|
279
|
-
Argue.setArguments('compile', '-o', '/var/tmp.txt,/var/log/my', 'myApp');
|
|
280
|
-
Argue.options([], [["output", "o"]]).should.be.deepEqual({
|
|
281
|
-
output: ['/var/tmp.txt', '/var/log/my']
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
describe("described as object", () => {
|
|
287
|
-
|
|
288
|
-
it('should throw error when given option is doesn\'t expected', () => {
|
|
289
|
-
|
|
290
|
-
Argue.setArguments('--input');
|
|
291
|
-
(() => Argue.options([], [{"output": "o"}])).should.throw(Error, {
|
|
292
|
-
message: 'Unexpected key "input".'
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it('should throw error when value of option is skiped', () => {
|
|
297
|
-
|
|
298
|
-
Argue.setArguments('--output');
|
|
299
|
-
(() => Argue.options([], [{"output": "o"}])).should.throw(Error, {
|
|
300
|
-
message: "Unexpected end of arguments."
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('should return empty object when no more arguments', () => {
|
|
305
|
-
|
|
306
|
-
Argue.setArguments();
|
|
307
|
-
Argue.options([], [{"output": "o"}]).should.be.deepEqual({});
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
it('should return empty object when key given instead flag', () => {
|
|
311
|
-
|
|
312
|
-
Argue.setArguments('install');
|
|
313
|
-
Argue.options([], [{"output": "o"}]).should.be.deepEqual({});
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
it('should return object with values if full flag is given', () => {
|
|
317
|
-
|
|
318
|
-
Argue.setArguments('--output', '/var/tmp.txt');
|
|
319
|
-
Argue.options([], [{"output": "o"}]).should.be.deepEqual({
|
|
320
|
-
output: '/var/tmp.txt'
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
it('should read all options and return object with values if full flag is given', () => {
|
|
325
|
-
|
|
326
|
-
Argue.setArguments('compile', '--output', '/var/tmp.txt', 'myApp');
|
|
327
|
-
Argue.options([], [{"output": "o"}]).should.be.deepEqual({
|
|
328
|
-
output: '/var/tmp.txt'
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it('should return object with values if shirt flag is given', () => {
|
|
333
|
-
|
|
334
|
-
Argue.setArguments('-o', '/var/tmp.txt');
|
|
335
|
-
Argue.options([], [{"output": "o"}]).should.be.deepEqual({
|
|
336
|
-
output: '/var/tmp.txt'
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
it('should read all options and return object with values if shirt flag is given', () => {
|
|
341
|
-
|
|
342
|
-
Argue.setArguments('compile', '-o', '/var/tmp.txt', 'myApp');
|
|
343
|
-
Argue.options([], [{"output": "o"}]).should.be.deepEqual({
|
|
344
|
-
output: '/var/tmp.txt'
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
});
|
package/test/read.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as Argue from '../src/lib';
|
|
2
|
-
|
|
3
|
-
describe("read()", () => {
|
|
4
|
-
|
|
5
|
-
it('should throw error when no more arguments', () => {
|
|
6
|
-
|
|
7
|
-
Argue.setArguments();
|
|
8
|
-
(() => Argue.read()).should.throw(Error, {
|
|
9
|
-
message: "Unexpected end of arguments."
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should return current argument', () => {
|
|
14
|
-
|
|
15
|
-
Argue.setArguments('argument');
|
|
16
|
-
Argue.read().should.be.equal('argument');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('should move to next arguments', () => {
|
|
20
|
-
|
|
21
|
-
Argue.setArguments('argument', 'argument2');
|
|
22
|
-
Argue.read().should.be.equal('argument');
|
|
23
|
-
Argue.read().should.be.equal('argument2');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as Argue from '../src/lib';
|
|
2
|
-
|
|
3
|
-
describe("strictOptionsEqual()", () => {
|
|
4
|
-
|
|
5
|
-
describe("when option described as string", () => {
|
|
6
|
-
|
|
7
|
-
it('should throw error when given option is doesn\'t expected', () => {
|
|
8
|
-
|
|
9
|
-
Argue.setArguments('--input');
|
|
10
|
-
(() => Argue.strictOptionsEqual("output")).should.throw(Error, {
|
|
11
|
-
message: 'Unexpected key "input".'
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should return empty object when no more arguments', () => {
|
|
16
|
-
|
|
17
|
-
Argue.setArguments();
|
|
18
|
-
Argue.strictOptions([], ["output"]).should.be.deepEqual({});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should return empty object when key given instead flag', () => {
|
|
22
|
-
|
|
23
|
-
Argue.setArguments('install');
|
|
24
|
-
Argue.strictOptionsEqual("output").should.be.deepEqual({});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should return object with values', () => {
|
|
28
|
-
|
|
29
|
-
Argue.setArguments('--output=/var/tmp.txt', '--verbose');
|
|
30
|
-
Argue.strictOptionsEqual("output", "verbose").should.be.deepEqual({
|
|
31
|
-
output: '/var/tmp.txt',
|
|
32
|
-
verbose: true
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe("when option described as array", () => {
|
|
38
|
-
|
|
39
|
-
it('should throw error when given option is doesn\'t expected', () => {
|
|
40
|
-
|
|
41
|
-
Argue.setArguments('--input');
|
|
42
|
-
(() => Argue.strictOptionsEqual(["output", "o"])).should.throw(Error, {
|
|
43
|
-
message: 'Unexpected key "input".'
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should return empty object when no more arguments', () => {
|
|
48
|
-
|
|
49
|
-
Argue.setArguments();
|
|
50
|
-
Argue.strictOptionsEqual(["output", "o"]).should.be.deepEqual({});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should return empty object when key given instead flag', () => {
|
|
54
|
-
|
|
55
|
-
Argue.setArguments('install');
|
|
56
|
-
Argue.strictOptionsEqual(["output", "o"]).should.be.deepEqual({});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should return object with values if full flag is given', () => {
|
|
60
|
-
|
|
61
|
-
Argue.setArguments('--output=/var/tmp.txt');
|
|
62
|
-
Argue.strictOptionsEqual(["output", "o"]).should.be.deepEqual({
|
|
63
|
-
output: ['/var/tmp.txt']
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should return object with array values if shirt flag is given', () => {
|
|
68
|
-
|
|
69
|
-
Argue.setArguments('--output=/var/tmp.txt,/var/log/my');
|
|
70
|
-
Argue.strictOptionsEqual(["output", "o"]).should.be.deepEqual({
|
|
71
|
-
output: ['/var/tmp.txt', '/var/log/my']
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should return object with values if shirt flag is given', () => {
|
|
76
|
-
|
|
77
|
-
Argue.setArguments('-o=/var/tmp.txt');
|
|
78
|
-
Argue.strictOptionsEqual(["output", "o"]).should.be.deepEqual({
|
|
79
|
-
output: ['/var/tmp.txt']
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should return object with array values if shirt flag is given', () => {
|
|
84
|
-
|
|
85
|
-
Argue.setArguments('-o=/var/tmp.txt,/var/log/my');
|
|
86
|
-
Argue.strictOptionsEqual(["output", "o"]).should.be.deepEqual({
|
|
87
|
-
output: ['/var/tmp.txt', '/var/log/my']
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
describe("when option described as object", () => {
|
|
93
|
-
|
|
94
|
-
it('should throw error when given option is doesn\'t expected', () => {
|
|
95
|
-
|
|
96
|
-
Argue.setArguments('--input');
|
|
97
|
-
(() => Argue.strictOptionsEqual({"output": "o"})).should.throw(Error, {
|
|
98
|
-
message: 'Unexpected key "input".'
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should return empty object when no more arguments', () => {
|
|
103
|
-
|
|
104
|
-
Argue.setArguments();
|
|
105
|
-
Argue.strictOptionsEqual({"output": "o"}).should.be.deepEqual({});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should return empty object when key given instead flag', () => {
|
|
109
|
-
|
|
110
|
-
Argue.setArguments('install');
|
|
111
|
-
Argue.strictOptionsEqual({"output": "o"}).should.be.deepEqual({});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('should return object with values if full flag is given', () => {
|
|
115
|
-
|
|
116
|
-
Argue.setArguments('--output=/var/tmp.txt', '--verbose');
|
|
117
|
-
Argue.strictOptionsEqual({"output": "o"}, {"verbose":"v"}).should.be.deepEqual({
|
|
118
|
-
output: '/var/tmp.txt',
|
|
119
|
-
verbose: true
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should return object with values if shirt flag is given', () => {
|
|
124
|
-
|
|
125
|
-
Argue.setArguments('-o=/var/tmp.txt', '-v');
|
|
126
|
-
Argue.strictOptionsEqual({"output": "o"}, {"verbose":"v"}).should.be.deepEqual({
|
|
127
|
-
output: '/var/tmp.txt',
|
|
128
|
-
verbose: true
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
});
|