goke 6.10.0 → 6.11.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/dist/__test__/completions.test.js +66 -66
- package/dist/__test__/index.test.js +379 -315
- package/dist/__test__/just-bash.test.js +7 -7
- package/dist/__test__/readme-examples.test.js +11 -11
- package/dist/goke.d.ts +4 -4
- package/dist/goke.d.ts.map +1 -1
- package/dist/goke.js +9 -4
- package/dist/just-bash.d.ts.map +1 -1
- package/dist/just-bash.js +1 -2
- package/package.json +1 -1
- package/src/__test__/completions.test.ts +66 -66
- package/src/__test__/index.test.ts +403 -315
- package/src/__test__/just-bash.test.ts +7 -7
- package/src/__test__/readme-examples.test.ts +11 -11
- package/src/goke.ts +13 -8
- package/src/just-bash.ts +1 -2
|
@@ -55,7 +55,7 @@ describe('getCompletions', () => {
|
|
|
55
55
|
delete process.env.SHELL;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
test('returns all visible commands when current word is empty', () => {
|
|
58
|
+
test('returns all visible commands when current word is empty', async () => {
|
|
59
59
|
process.env.SHELL = '/bin/bash';
|
|
60
60
|
const { cli } = buildTestCli();
|
|
61
61
|
const completions = cli.getCompletions(['mycli', '']);
|
|
@@ -68,13 +68,13 @@ describe('getCompletions', () => {
|
|
|
68
68
|
]
|
|
69
69
|
`);
|
|
70
70
|
});
|
|
71
|
-
test('hidden commands are excluded', () => {
|
|
71
|
+
test('hidden commands are excluded', async () => {
|
|
72
72
|
process.env.SHELL = '/bin/bash';
|
|
73
73
|
const { cli } = buildTestCli();
|
|
74
74
|
const completions = cli.getCompletions(['mycli', '']);
|
|
75
75
|
expect(completions).not.toContain('internal-debug');
|
|
76
76
|
});
|
|
77
|
-
test('filters commands by prefix', () => {
|
|
77
|
+
test('filters commands by prefix', async () => {
|
|
78
78
|
process.env.SHELL = '/bin/bash';
|
|
79
79
|
const { cli } = buildTestCli();
|
|
80
80
|
const completions = cli.getCompletions(['mycli', 'dep']);
|
|
@@ -84,7 +84,7 @@ describe('getCompletions', () => {
|
|
|
84
84
|
]
|
|
85
85
|
`);
|
|
86
86
|
});
|
|
87
|
-
test('suggests options after matched command', () => {
|
|
87
|
+
test('suggests options after matched command', async () => {
|
|
88
88
|
process.env.SHELL = '/bin/bash';
|
|
89
89
|
const { cli } = buildTestCli();
|
|
90
90
|
const completions = cli.getCompletions(['mycli', 'deploy', '--']);
|
|
@@ -92,13 +92,13 @@ describe('getCompletions', () => {
|
|
|
92
92
|
expect(completions).toContain('--dry-run');
|
|
93
93
|
expect(completions).toContain('--help');
|
|
94
94
|
});
|
|
95
|
-
test('suggests subcommands after matched command prefix', () => {
|
|
95
|
+
test('suggests subcommands after matched command prefix', async () => {
|
|
96
96
|
process.env.SHELL = '/bin/bash';
|
|
97
97
|
const { cli } = buildTestCli();
|
|
98
98
|
const completions = cli.getCompletions(['mycli', 'deploy', '']);
|
|
99
99
|
expect(completions).toContain('rollback');
|
|
100
100
|
});
|
|
101
|
-
test('includes descriptions in zsh format', () => {
|
|
101
|
+
test('includes descriptions in zsh format', async () => {
|
|
102
102
|
process.env.SHELL = '/bin/zsh';
|
|
103
103
|
const { cli } = buildTestCli();
|
|
104
104
|
const completions = cli.getCompletions(['mycli', '']);
|
|
@@ -106,14 +106,14 @@ describe('getCompletions', () => {
|
|
|
106
106
|
expect(completions.some((c) => c.includes(':Deploy the app'))).toBe(true);
|
|
107
107
|
expect(completions.some((c) => c.includes(':Stream deployment logs'))).toBe(true);
|
|
108
108
|
});
|
|
109
|
-
test('zsh option completions include descriptions', () => {
|
|
109
|
+
test('zsh option completions include descriptions', async () => {
|
|
110
110
|
process.env.SHELL = '/bin/zsh';
|
|
111
111
|
const { cli } = buildTestCli();
|
|
112
112
|
const completions = cli.getCompletions(['mycli', 'deploy', '--']);
|
|
113
113
|
expect(completions.some((c) => c.includes('--env:Target environment'))).toBe(true);
|
|
114
114
|
expect(completions.some((c) => c.includes('--dry-run:Preview without deploying'))).toBe(true);
|
|
115
115
|
});
|
|
116
|
-
test('filters options by prefix', () => {
|
|
116
|
+
test('filters options by prefix', async () => {
|
|
117
117
|
process.env.SHELL = '/bin/bash';
|
|
118
118
|
const { cli } = buildTestCli();
|
|
119
119
|
const completions = cli.getCompletions(['mycli', 'deploy', '--dr']);
|
|
@@ -123,13 +123,13 @@ describe('getCompletions', () => {
|
|
|
123
123
|
]
|
|
124
124
|
`);
|
|
125
125
|
});
|
|
126
|
-
test('suggests global options at root level', () => {
|
|
126
|
+
test('suggests global options at root level', async () => {
|
|
127
127
|
process.env.SHELL = '/bin/bash';
|
|
128
128
|
const { cli } = buildTestCli();
|
|
129
129
|
const completions = cli.getCompletions(['mycli', '--']);
|
|
130
130
|
expect(completions).toContain('--help');
|
|
131
131
|
});
|
|
132
|
-
test('multi-word command completion', () => {
|
|
132
|
+
test('multi-word command completion', async () => {
|
|
133
133
|
process.env.SHELL = '/bin/bash';
|
|
134
134
|
const { cli } = buildTestCli();
|
|
135
135
|
// User typed "mycli deploy " and hits tab
|
|
@@ -142,44 +142,44 @@ describe('getCompletions', () => {
|
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
describe('--get-goke-completions flag in parse()', () => {
|
|
145
|
-
test('prints completions to stdout and exits', () => {
|
|
145
|
+
test('prints completions to stdout and exits', async () => {
|
|
146
146
|
const stdout = createTestOutputStream();
|
|
147
147
|
const { cli } = buildTestCli(stdout);
|
|
148
148
|
// Simulate: mycli --get-goke-completions mycli dep
|
|
149
|
-
cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'dep']);
|
|
149
|
+
await cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'dep']);
|
|
150
150
|
// Should have printed completions to stdout
|
|
151
151
|
expect(stdout.text).toContain('deploy');
|
|
152
152
|
});
|
|
153
|
-
test('does not run any command action', () => {
|
|
153
|
+
test('does not run any command action', async () => {
|
|
154
154
|
const stdout = createTestOutputStream();
|
|
155
155
|
const actionSpy = vi.fn();
|
|
156
156
|
const cli = gokeTestable('mycli', { stdout })
|
|
157
157
|
.completions();
|
|
158
158
|
cli.command('deploy', 'Deploy').action(actionSpy);
|
|
159
|
-
cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'deploy', '']);
|
|
159
|
+
await cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'deploy', '']);
|
|
160
160
|
expect(actionSpy).not.toHaveBeenCalled();
|
|
161
161
|
});
|
|
162
162
|
});
|
|
163
163
|
describe('generateCompletionScript', () => {
|
|
164
|
-
test('zsh template has #compdef header', () => {
|
|
164
|
+
test('zsh template has #compdef header', async () => {
|
|
165
165
|
const script = generateCompletionScript('zsh', 'my-cli', '/usr/local/bin/my-cli');
|
|
166
166
|
expect(script).toContain('#compdef my-cli');
|
|
167
167
|
expect(script).toContain('--get-goke-completions');
|
|
168
168
|
expect(script).toContain('/usr/local/bin/my-cli');
|
|
169
169
|
expect(script).toContain('_my_cli_completions');
|
|
170
170
|
});
|
|
171
|
-
test('bash template has complete command', () => {
|
|
171
|
+
test('bash template has complete command', async () => {
|
|
172
172
|
const script = generateCompletionScript('bash', 'my-cli', '/usr/local/bin/my-cli');
|
|
173
173
|
expect(script).toContain('complete -o bashdefault');
|
|
174
174
|
expect(script).toContain('--get-goke-completions');
|
|
175
175
|
expect(script).toContain('/usr/local/bin/my-cli');
|
|
176
176
|
expect(script).toContain('_my_cli_completions');
|
|
177
177
|
});
|
|
178
|
-
test('uses cliName as fallback path when cliPath not provided', () => {
|
|
178
|
+
test('uses cliName as fallback path when cliPath not provided', async () => {
|
|
179
179
|
const script = generateCompletionScript('zsh', 'my-cli');
|
|
180
180
|
expect(script).toContain('my-cli --get-goke-completions');
|
|
181
181
|
});
|
|
182
|
-
test('escapes special characters in function names', () => {
|
|
182
|
+
test('escapes special characters in function names', async () => {
|
|
183
183
|
const script = generateCompletionScript('zsh', 'my-cli.js', './my-cli.js');
|
|
184
184
|
// Function name should use underscores
|
|
185
185
|
expect(script).toContain('_my_cli_js_completions');
|
|
@@ -188,20 +188,20 @@ describe('generateCompletionScript', () => {
|
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
describe('completions commands', () => {
|
|
191
|
-
test('completions script prints zsh script', () => {
|
|
191
|
+
test('completions script prints zsh script', async () => {
|
|
192
192
|
process.env.SHELL = '/bin/zsh';
|
|
193
193
|
const stdout = createTestOutputStream();
|
|
194
194
|
const cli = gokeTestable('mycli', { stdout })
|
|
195
195
|
.completions();
|
|
196
|
-
cli.parse(['node', 'bin', 'completions', 'script']);
|
|
196
|
+
await cli.parse(['node', 'bin', 'completions', 'script']);
|
|
197
197
|
expect(stdout.text).toContain('#compdef mycli');
|
|
198
198
|
expect(stdout.text).toContain('--get-goke-completions');
|
|
199
199
|
});
|
|
200
|
-
test('completions script prints bash script with --shell', () => {
|
|
200
|
+
test('completions script prints bash script with --shell', async () => {
|
|
201
201
|
const stdout = createTestOutputStream();
|
|
202
202
|
const cli = gokeTestable('mycli', { stdout })
|
|
203
203
|
.completions();
|
|
204
|
-
cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'bash']);
|
|
204
|
+
await cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'bash']);
|
|
205
205
|
expect(stdout.text).toContain('complete -o bashdefault');
|
|
206
206
|
expect(stdout.text).toContain('--get-goke-completions');
|
|
207
207
|
});
|
|
@@ -209,7 +209,7 @@ describe('completions commands', () => {
|
|
|
209
209
|
const stderr = createTestOutputStream();
|
|
210
210
|
const cli = gokeTestable('mycli', { stderr })
|
|
211
211
|
.completions();
|
|
212
|
-
cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'fish']);
|
|
212
|
+
await cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'fish']);
|
|
213
213
|
// The error is caught by handleCliError and printed to stderr
|
|
214
214
|
// Wait a tick for the sync action to complete
|
|
215
215
|
await new Promise((r) => setTimeout(r, 10));
|
|
@@ -233,7 +233,7 @@ describe('GOKE_COMPLETION_SHELL env var', () => {
|
|
|
233
233
|
else
|
|
234
234
|
delete process.env.GOKE_COMPLETION_SHELL;
|
|
235
235
|
});
|
|
236
|
-
test('uses GOKE_COMPLETION_SHELL over SHELL for format detection', () => {
|
|
236
|
+
test('uses GOKE_COMPLETION_SHELL over SHELL for format detection', async () => {
|
|
237
237
|
// Login shell is zsh but the bash shim sets GOKE_COMPLETION_SHELL=bash
|
|
238
238
|
process.env.SHELL = '/bin/zsh';
|
|
239
239
|
process.env.GOKE_COMPLETION_SHELL = 'bash';
|
|
@@ -244,11 +244,11 @@ describe('GOKE_COMPLETION_SHELL env var', () => {
|
|
|
244
244
|
expect(c).not.toContain(':');
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
|
-
test('zsh template sets GOKE_COMPLETION_SHELL=zsh', () => {
|
|
247
|
+
test('zsh template sets GOKE_COMPLETION_SHELL=zsh', async () => {
|
|
248
248
|
const script = generateCompletionScript('zsh', 'mycli');
|
|
249
249
|
expect(script).toContain('GOKE_COMPLETION_SHELL=zsh');
|
|
250
250
|
});
|
|
251
|
-
test('bash template sets GOKE_COMPLETION_SHELL=bash', () => {
|
|
251
|
+
test('bash template sets GOKE_COMPLETION_SHELL=bash', async () => {
|
|
252
252
|
const script = generateCompletionScript('bash', 'mycli');
|
|
253
253
|
expect(script).toContain('GOKE_COMPLETION_SHELL=bash');
|
|
254
254
|
});
|
|
@@ -266,13 +266,13 @@ describe('option value position', () => {
|
|
|
266
266
|
else
|
|
267
267
|
delete process.env.SHELL;
|
|
268
268
|
});
|
|
269
|
-
test('returns empty when previous token is a value-taking option', () => {
|
|
269
|
+
test('returns empty when previous token is a value-taking option', async () => {
|
|
270
270
|
const { cli } = buildTestCli();
|
|
271
271
|
// mycli deploy --env <TAB> — should not suggest flags
|
|
272
272
|
const completions = cli.getCompletions(['mycli', 'deploy', '--env', '']);
|
|
273
273
|
expect(completions).toEqual([]);
|
|
274
274
|
});
|
|
275
|
-
test('still suggests flags when previous token is a boolean option', () => {
|
|
275
|
+
test('still suggests flags when previous token is a boolean option', async () => {
|
|
276
276
|
const { cli } = buildTestCli();
|
|
277
277
|
// mycli deploy --dry-run <TAB> — boolean flag, should still suggest
|
|
278
278
|
const completions = cli.getCompletions(['mycli', 'deploy', '--dry-run', '--']);
|
|
@@ -292,7 +292,7 @@ describe('default command options', () => {
|
|
|
292
292
|
else
|
|
293
293
|
delete process.env.SHELL;
|
|
294
294
|
});
|
|
295
|
-
test('includes default command options at root level', () => {
|
|
295
|
+
test('includes default command options at root level', async () => {
|
|
296
296
|
const cli = gokeTestable('mycli')
|
|
297
297
|
.help()
|
|
298
298
|
.completions();
|
|
@@ -318,7 +318,7 @@ describe('alias suppression', () => {
|
|
|
318
318
|
else
|
|
319
319
|
delete process.env.SHELL;
|
|
320
320
|
});
|
|
321
|
-
test('suppresses --dry-run when -d alias was already used', () => {
|
|
321
|
+
test('suppresses --dry-run when -d alias was already used', async () => {
|
|
322
322
|
const cli = gokeTestable('mycli')
|
|
323
323
|
.completions();
|
|
324
324
|
cli.command('deploy', 'Deploy')
|
|
@@ -372,7 +372,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
372
372
|
cli.command('secret', 'Secret command').hidden();
|
|
373
373
|
return cli;
|
|
374
374
|
}
|
|
375
|
-
test('app <TAB> — empty after CLI name', () => {
|
|
375
|
+
test('app <TAB> — empty after CLI name', async () => {
|
|
376
376
|
const cli = buildRootCli();
|
|
377
377
|
expect(cli.getCompletions(['app', ''])).toMatchInlineSnapshot(`
|
|
378
378
|
[
|
|
@@ -382,7 +382,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
382
382
|
]
|
|
383
383
|
`);
|
|
384
384
|
});
|
|
385
|
-
test('app i<TAB> — partial command', () => {
|
|
385
|
+
test('app i<TAB> — partial command', async () => {
|
|
386
386
|
const cli = buildRootCli();
|
|
387
387
|
expect(cli.getCompletions(['app', 'i'])).toMatchInlineSnapshot(`
|
|
388
388
|
[
|
|
@@ -390,7 +390,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
390
390
|
]
|
|
391
391
|
`);
|
|
392
392
|
});
|
|
393
|
-
test('app --<TAB> — flags at root level', () => {
|
|
393
|
+
test('app --<TAB> — flags at root level', async () => {
|
|
394
394
|
const cli = buildRootCli();
|
|
395
395
|
expect(cli.getCompletions(['app', '--'])).toMatchInlineSnapshot(`
|
|
396
396
|
[
|
|
@@ -401,7 +401,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
401
401
|
]
|
|
402
402
|
`);
|
|
403
403
|
});
|
|
404
|
-
test('app --p<TAB> — partial flag', () => {
|
|
404
|
+
test('app --p<TAB> — partial flag', async () => {
|
|
405
405
|
const cli = buildRootCli();
|
|
406
406
|
expect(cli.getCompletions(['app', '--p'])).toMatchInlineSnapshot(`
|
|
407
407
|
[
|
|
@@ -409,11 +409,11 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
409
409
|
]
|
|
410
410
|
`);
|
|
411
411
|
});
|
|
412
|
-
test('app --port <TAB> — after value-taking option', () => {
|
|
412
|
+
test('app --port <TAB> — after value-taking option', async () => {
|
|
413
413
|
const cli = buildRootCli();
|
|
414
414
|
expect(cli.getCompletions(['app', '--port', ''])).toMatchInlineSnapshot(`[]`);
|
|
415
415
|
});
|
|
416
|
-
test('app --verbose <TAB> — after boolean flag', () => {
|
|
416
|
+
test('app --verbose <TAB> — after boolean flag', async () => {
|
|
417
417
|
const cli = buildRootCli();
|
|
418
418
|
expect(cli.getCompletions(['app', '--verbose', ''])).toMatchInlineSnapshot(`
|
|
419
419
|
[
|
|
@@ -421,7 +421,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
421
421
|
]
|
|
422
422
|
`);
|
|
423
423
|
});
|
|
424
|
-
test('app --verbose --<TAB> — more flags after boolean', () => {
|
|
424
|
+
test('app --verbose --<TAB> — more flags after boolean', async () => {
|
|
425
425
|
const cli = buildRootCli();
|
|
426
426
|
expect(cli.getCompletions(['app', '--verbose', '--'])).toMatchInlineSnapshot(`
|
|
427
427
|
[
|
|
@@ -432,7 +432,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
432
432
|
]
|
|
433
433
|
`);
|
|
434
434
|
});
|
|
435
|
-
test('app init <TAB> — after named command', () => {
|
|
435
|
+
test('app init <TAB> — after named command', async () => {
|
|
436
436
|
const cli = buildRootCli();
|
|
437
437
|
expect(cli.getCompletions(['app', 'init', ''])).toMatchInlineSnapshot(`
|
|
438
438
|
[
|
|
@@ -442,7 +442,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
442
442
|
]
|
|
443
443
|
`);
|
|
444
444
|
});
|
|
445
|
-
test('app init --<TAB> — flags for named command', () => {
|
|
445
|
+
test('app init --<TAB> — flags for named command', async () => {
|
|
446
446
|
const cli = buildRootCli();
|
|
447
447
|
expect(cli.getCompletions(['app', 'init', '--'])).toMatchInlineSnapshot(`
|
|
448
448
|
[
|
|
@@ -452,7 +452,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
452
452
|
]
|
|
453
453
|
`);
|
|
454
454
|
});
|
|
455
|
-
test('app init --force --<TAB> — remaining flags after used boolean', () => {
|
|
455
|
+
test('app init --force --<TAB> — remaining flags after used boolean', async () => {
|
|
456
456
|
const cli = buildRootCli();
|
|
457
457
|
expect(cli.getCompletions(['app', 'init', '--force', '--'])).toMatchInlineSnapshot(`
|
|
458
458
|
[
|
|
@@ -461,11 +461,11 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
461
461
|
]
|
|
462
462
|
`);
|
|
463
463
|
});
|
|
464
|
-
test('app init --template <TAB> — after value-taking flag', () => {
|
|
464
|
+
test('app init --template <TAB> — after value-taking flag', async () => {
|
|
465
465
|
const cli = buildRootCli();
|
|
466
466
|
expect(cli.getCompletions(['app', 'init', '--template', ''])).toMatchInlineSnapshot(`[]`);
|
|
467
467
|
});
|
|
468
|
-
test('app config <TAB> — namespace with subcommands', () => {
|
|
468
|
+
test('app config <TAB> — namespace with subcommands', async () => {
|
|
469
469
|
const cli = buildRootCli();
|
|
470
470
|
expect(cli.getCompletions(['app', 'config', ''])).toMatchInlineSnapshot(`
|
|
471
471
|
[
|
|
@@ -475,7 +475,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
475
475
|
]
|
|
476
476
|
`);
|
|
477
477
|
});
|
|
478
|
-
test('app config s<TAB> — partial subcommand', () => {
|
|
478
|
+
test('app config s<TAB> — partial subcommand', async () => {
|
|
479
479
|
const cli = buildRootCli();
|
|
480
480
|
expect(cli.getCompletions(['app', 'config', 's'])).toMatchInlineSnapshot(`
|
|
481
481
|
[
|
|
@@ -483,7 +483,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
483
483
|
]
|
|
484
484
|
`);
|
|
485
485
|
});
|
|
486
|
-
test('app config list --<TAB> — flags for nested subcommand', () => {
|
|
486
|
+
test('app config list --<TAB> — flags for nested subcommand', async () => {
|
|
487
487
|
const cli = buildRootCli();
|
|
488
488
|
expect(cli.getCompletions(['app', 'config', 'list', '--'])).toMatchInlineSnapshot(`
|
|
489
489
|
[
|
|
@@ -491,11 +491,11 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
491
491
|
]
|
|
492
492
|
`);
|
|
493
493
|
});
|
|
494
|
-
test('app x<TAB> — no matching command', () => {
|
|
494
|
+
test('app x<TAB> — no matching command', async () => {
|
|
495
495
|
const cli = buildRootCli();
|
|
496
496
|
expect(cli.getCompletions(['app', 'x'])).toMatchInlineSnapshot(`[]`);
|
|
497
497
|
});
|
|
498
|
-
test('hidden commands never appear', () => {
|
|
498
|
+
test('hidden commands never appear', async () => {
|
|
499
499
|
const cli = buildRootCli();
|
|
500
500
|
const all = cli.getCompletions(['app', '']);
|
|
501
501
|
expect(all).not.toContain('secret');
|
|
@@ -546,7 +546,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
546
546
|
.option('--tail <lines>', z.number().default(100).describe('Number of lines'));
|
|
547
547
|
return cli;
|
|
548
548
|
}
|
|
549
|
-
test('kubectl <TAB> — top-level commands', () => {
|
|
549
|
+
test('kubectl <TAB> — top-level commands', async () => {
|
|
550
550
|
const cli = buildNamespacedCli();
|
|
551
551
|
expect(cli.getCompletions(['kubectl', ''])).toMatchInlineSnapshot(`
|
|
552
552
|
[
|
|
@@ -559,7 +559,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
559
559
|
]
|
|
560
560
|
`);
|
|
561
561
|
});
|
|
562
|
-
test('kubectl g<TAB> — partial match', () => {
|
|
562
|
+
test('kubectl g<TAB> — partial match', async () => {
|
|
563
563
|
const cli = buildNamespacedCli();
|
|
564
564
|
expect(cli.getCompletions(['kubectl', 'g'])).toMatchInlineSnapshot(`
|
|
565
565
|
[
|
|
@@ -567,7 +567,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
567
567
|
]
|
|
568
568
|
`);
|
|
569
569
|
});
|
|
570
|
-
test('kubectl --<TAB> — global options at root', () => {
|
|
570
|
+
test('kubectl --<TAB> — global options at root', async () => {
|
|
571
571
|
const cli = buildNamespacedCli();
|
|
572
572
|
expect(cli.getCompletions(['kubectl', '--'])).toMatchInlineSnapshot(`
|
|
573
573
|
[
|
|
@@ -577,11 +577,11 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
577
577
|
]
|
|
578
578
|
`);
|
|
579
579
|
});
|
|
580
|
-
test('kubectl --context <TAB> — after global value option', () => {
|
|
580
|
+
test('kubectl --context <TAB> — after global value option', async () => {
|
|
581
581
|
const cli = buildNamespacedCli();
|
|
582
582
|
expect(cli.getCompletions(['kubectl', '--context', ''])).toMatchInlineSnapshot(`[]`);
|
|
583
583
|
});
|
|
584
|
-
test('kubectl get <TAB> — subcommands under namespace', () => {
|
|
584
|
+
test('kubectl get <TAB> — subcommands under namespace', async () => {
|
|
585
585
|
const cli = buildNamespacedCli();
|
|
586
586
|
expect(cli.getCompletions(['kubectl', 'get', ''])).toMatchInlineSnapshot(`
|
|
587
587
|
[
|
|
@@ -591,7 +591,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
591
591
|
]
|
|
592
592
|
`);
|
|
593
593
|
});
|
|
594
|
-
test('kubectl get p<TAB> — partial subcommand', () => {
|
|
594
|
+
test('kubectl get p<TAB> — partial subcommand', async () => {
|
|
595
595
|
const cli = buildNamespacedCli();
|
|
596
596
|
expect(cli.getCompletions(['kubectl', 'get', 'p'])).toMatchInlineSnapshot(`
|
|
597
597
|
[
|
|
@@ -599,7 +599,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
599
599
|
]
|
|
600
600
|
`);
|
|
601
601
|
});
|
|
602
|
-
test('kubectl get pods --<TAB> — options for nested command', () => {
|
|
602
|
+
test('kubectl get pods --<TAB> — options for nested command', async () => {
|
|
603
603
|
const cli = buildNamespacedCli();
|
|
604
604
|
expect(cli.getCompletions(['kubectl', 'get', 'pods', '--'])).toMatchInlineSnapshot(`
|
|
605
605
|
[
|
|
@@ -612,7 +612,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
612
612
|
]
|
|
613
613
|
`);
|
|
614
614
|
});
|
|
615
|
-
test('kubectl get pods -A --<TAB> — remaining options after used flag', () => {
|
|
615
|
+
test('kubectl get pods -A --<TAB> — remaining options after used flag', async () => {
|
|
616
616
|
const cli = buildNamespacedCli();
|
|
617
617
|
expect(cli.getCompletions(['kubectl', 'get', 'pods', '-A', '--'])).toMatchInlineSnapshot(`
|
|
618
618
|
[
|
|
@@ -624,11 +624,11 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
624
624
|
]
|
|
625
625
|
`);
|
|
626
626
|
});
|
|
627
|
-
test('kubectl get pods --output <TAB> — after value option', () => {
|
|
627
|
+
test('kubectl get pods --output <TAB> — after value option', async () => {
|
|
628
628
|
const cli = buildNamespacedCli();
|
|
629
629
|
expect(cli.getCompletions(['kubectl', 'get', 'pods', '--output', ''])).toMatchInlineSnapshot(`[]`);
|
|
630
630
|
});
|
|
631
|
-
test('kubectl describe <TAB> — subcommands', () => {
|
|
631
|
+
test('kubectl describe <TAB> — subcommands', async () => {
|
|
632
632
|
const cli = buildNamespacedCli();
|
|
633
633
|
expect(cli.getCompletions(['kubectl', 'describe', ''])).toMatchInlineSnapshot(`
|
|
634
634
|
[
|
|
@@ -637,7 +637,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
637
637
|
]
|
|
638
638
|
`);
|
|
639
639
|
});
|
|
640
|
-
test('kubectl apply --<TAB> — options for apply', () => {
|
|
640
|
+
test('kubectl apply --<TAB> — options for apply', async () => {
|
|
641
641
|
const cli = buildNamespacedCli();
|
|
642
642
|
expect(cli.getCompletions(['kubectl', 'apply', '--'])).toMatchInlineSnapshot(`
|
|
643
643
|
[
|
|
@@ -649,7 +649,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
649
649
|
]
|
|
650
650
|
`);
|
|
651
651
|
});
|
|
652
|
-
test('kubectl apply --dry-run --<TAB> — after used boolean', () => {
|
|
652
|
+
test('kubectl apply --dry-run --<TAB> — after used boolean', async () => {
|
|
653
653
|
const cli = buildNamespacedCli();
|
|
654
654
|
expect(cli.getCompletions(['kubectl', 'apply', '--dry-run', '--'])).toMatchInlineSnapshot(`
|
|
655
655
|
[
|
|
@@ -660,7 +660,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
660
660
|
]
|
|
661
661
|
`);
|
|
662
662
|
});
|
|
663
|
-
test('kubectl delete pod myapp --<TAB> — options after positional arg', () => {
|
|
663
|
+
test('kubectl delete pod myapp --<TAB> — options after positional arg', async () => {
|
|
664
664
|
const cli = buildNamespacedCli();
|
|
665
665
|
expect(cli.getCompletions(['kubectl', 'delete', 'pod', 'myapp', '--'])).toMatchInlineSnapshot(`
|
|
666
666
|
[
|
|
@@ -672,7 +672,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
672
672
|
]
|
|
673
673
|
`);
|
|
674
674
|
});
|
|
675
|
-
test('kubectl logs mypod --<TAB> — options for logs', () => {
|
|
675
|
+
test('kubectl logs mypod --<TAB> — options for logs', async () => {
|
|
676
676
|
const cli = buildNamespacedCli();
|
|
677
677
|
expect(cli.getCompletions(['kubectl', 'logs', 'mypod', '--'])).toMatchInlineSnapshot(`
|
|
678
678
|
[
|
|
@@ -684,7 +684,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
684
684
|
]
|
|
685
685
|
`);
|
|
686
686
|
});
|
|
687
|
-
test('kubectl logs mypod -f --<TAB> — after short boolean alias', () => {
|
|
687
|
+
test('kubectl logs mypod -f --<TAB> — after short boolean alias', async () => {
|
|
688
688
|
const cli = buildNamespacedCli();
|
|
689
689
|
expect(cli.getCompletions(['kubectl', 'logs', 'mypod', '-f', '--'])).toMatchInlineSnapshot(`
|
|
690
690
|
[
|
|
@@ -695,11 +695,11 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
695
695
|
]
|
|
696
696
|
`);
|
|
697
697
|
});
|
|
698
|
-
test('kubectl logs mypod --tail <TAB> — after value option', () => {
|
|
698
|
+
test('kubectl logs mypod --tail <TAB> — after value option', async () => {
|
|
699
699
|
const cli = buildNamespacedCli();
|
|
700
700
|
expect(cli.getCompletions(['kubectl', 'logs', 'mypod', '--tail', ''])).toMatchInlineSnapshot(`[]`);
|
|
701
701
|
});
|
|
702
|
-
test('kubectl nonexistent <TAB> — unknown command', () => {
|
|
702
|
+
test('kubectl nonexistent <TAB> — unknown command', async () => {
|
|
703
703
|
const cli = buildNamespacedCli();
|
|
704
704
|
expect(cli.getCompletions(['kubectl', 'nonexistent', ''])).toMatchInlineSnapshot(`
|
|
705
705
|
[
|
|
@@ -740,7 +740,7 @@ describe('completion snapshots: zsh format', () => {
|
|
|
740
740
|
cli.command('done <id>', 'Mark a todo as done');
|
|
741
741
|
return cli;
|
|
742
742
|
}
|
|
743
|
-
test('todo <TAB> — commands with descriptions', () => {
|
|
743
|
+
test('todo <TAB> — commands with descriptions', async () => {
|
|
744
744
|
const cli = buildZshCli();
|
|
745
745
|
expect(cli.getCompletions(['todo', ''])).toMatchInlineSnapshot(`
|
|
746
746
|
[
|
|
@@ -751,7 +751,7 @@ describe('completion snapshots: zsh format', () => {
|
|
|
751
751
|
]
|
|
752
752
|
`);
|
|
753
753
|
});
|
|
754
|
-
test('todo add myitem --<TAB> — options with descriptions', () => {
|
|
754
|
+
test('todo add myitem --<TAB> — options with descriptions', async () => {
|
|
755
755
|
const cli = buildZshCli();
|
|
756
756
|
expect(cli.getCompletions(['todo', 'add', 'myitem', '--'])).toMatchInlineSnapshot(`
|
|
757
757
|
[
|
|
@@ -761,7 +761,7 @@ describe('completion snapshots: zsh format', () => {
|
|
|
761
761
|
]
|
|
762
762
|
`);
|
|
763
763
|
});
|
|
764
|
-
test('todo list --<TAB> — list options with descriptions', () => {
|
|
764
|
+
test('todo list --<TAB> — list options with descriptions', async () => {
|
|
765
765
|
const cli = buildZshCli();
|
|
766
766
|
expect(cli.getCompletions(['todo', 'list', '--'])).toMatchInlineSnapshot(`
|
|
767
767
|
[
|