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
|
@@ -70,7 +70,7 @@ describe('getCompletions', () => {
|
|
|
70
70
|
}
|
|
71
71
|
})
|
|
72
72
|
|
|
73
|
-
test('returns all visible commands when current word is empty', () => {
|
|
73
|
+
test('returns all visible commands when current word is empty', async () => {
|
|
74
74
|
process.env.SHELL = '/bin/bash'
|
|
75
75
|
const { cli } = buildTestCli()
|
|
76
76
|
const completions = cli.getCompletions(['mycli', ''])
|
|
@@ -85,7 +85,7 @@ describe('getCompletions', () => {
|
|
|
85
85
|
`)
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
test('hidden commands are excluded', () => {
|
|
88
|
+
test('hidden commands are excluded', async () => {
|
|
89
89
|
process.env.SHELL = '/bin/bash'
|
|
90
90
|
const { cli } = buildTestCli()
|
|
91
91
|
const completions = cli.getCompletions(['mycli', ''])
|
|
@@ -93,7 +93,7 @@ describe('getCompletions', () => {
|
|
|
93
93
|
expect(completions).not.toContain('internal-debug')
|
|
94
94
|
})
|
|
95
95
|
|
|
96
|
-
test('filters commands by prefix', () => {
|
|
96
|
+
test('filters commands by prefix', async () => {
|
|
97
97
|
process.env.SHELL = '/bin/bash'
|
|
98
98
|
const { cli } = buildTestCli()
|
|
99
99
|
const completions = cli.getCompletions(['mycli', 'dep'])
|
|
@@ -105,7 +105,7 @@ describe('getCompletions', () => {
|
|
|
105
105
|
`)
|
|
106
106
|
})
|
|
107
107
|
|
|
108
|
-
test('suggests options after matched command', () => {
|
|
108
|
+
test('suggests options after matched command', async () => {
|
|
109
109
|
process.env.SHELL = '/bin/bash'
|
|
110
110
|
const { cli } = buildTestCli()
|
|
111
111
|
const completions = cli.getCompletions(['mycli', 'deploy', '--'])
|
|
@@ -115,7 +115,7 @@ describe('getCompletions', () => {
|
|
|
115
115
|
expect(completions).toContain('--help')
|
|
116
116
|
})
|
|
117
117
|
|
|
118
|
-
test('suggests subcommands after matched command prefix', () => {
|
|
118
|
+
test('suggests subcommands after matched command prefix', async () => {
|
|
119
119
|
process.env.SHELL = '/bin/bash'
|
|
120
120
|
const { cli } = buildTestCli()
|
|
121
121
|
const completions = cli.getCompletions(['mycli', 'deploy', ''])
|
|
@@ -123,7 +123,7 @@ describe('getCompletions', () => {
|
|
|
123
123
|
expect(completions).toContain('rollback')
|
|
124
124
|
})
|
|
125
125
|
|
|
126
|
-
test('includes descriptions in zsh format', () => {
|
|
126
|
+
test('includes descriptions in zsh format', async () => {
|
|
127
127
|
process.env.SHELL = '/bin/zsh'
|
|
128
128
|
const { cli } = buildTestCli()
|
|
129
129
|
const completions = cli.getCompletions(['mycli', ''])
|
|
@@ -133,7 +133,7 @@ describe('getCompletions', () => {
|
|
|
133
133
|
expect(completions.some((c) => c.includes(':Stream deployment logs'))).toBe(true)
|
|
134
134
|
})
|
|
135
135
|
|
|
136
|
-
test('zsh option completions include descriptions', () => {
|
|
136
|
+
test('zsh option completions include descriptions', async () => {
|
|
137
137
|
process.env.SHELL = '/bin/zsh'
|
|
138
138
|
const { cli } = buildTestCli()
|
|
139
139
|
const completions = cli.getCompletions(['mycli', 'deploy', '--'])
|
|
@@ -142,7 +142,7 @@ describe('getCompletions', () => {
|
|
|
142
142
|
expect(completions.some((c) => c.includes('--dry-run:Preview without deploying'))).toBe(true)
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
test('filters options by prefix', () => {
|
|
145
|
+
test('filters options by prefix', async () => {
|
|
146
146
|
process.env.SHELL = '/bin/bash'
|
|
147
147
|
const { cli } = buildTestCli()
|
|
148
148
|
const completions = cli.getCompletions(['mycli', 'deploy', '--dr'])
|
|
@@ -154,7 +154,7 @@ describe('getCompletions', () => {
|
|
|
154
154
|
`)
|
|
155
155
|
})
|
|
156
156
|
|
|
157
|
-
test('suggests global options at root level', () => {
|
|
157
|
+
test('suggests global options at root level', async () => {
|
|
158
158
|
process.env.SHELL = '/bin/bash'
|
|
159
159
|
const { cli } = buildTestCli()
|
|
160
160
|
const completions = cli.getCompletions(['mycli', '--'])
|
|
@@ -162,7 +162,7 @@ describe('getCompletions', () => {
|
|
|
162
162
|
expect(completions).toContain('--help')
|
|
163
163
|
})
|
|
164
164
|
|
|
165
|
-
test('multi-word command completion', () => {
|
|
165
|
+
test('multi-word command completion', async () => {
|
|
166
166
|
process.env.SHELL = '/bin/bash'
|
|
167
167
|
const { cli } = buildTestCli()
|
|
168
168
|
// User typed "mycli deploy " and hits tab
|
|
@@ -177,32 +177,32 @@ describe('getCompletions', () => {
|
|
|
177
177
|
})
|
|
178
178
|
|
|
179
179
|
describe('--get-goke-completions flag in parse()', () => {
|
|
180
|
-
test('prints completions to stdout and exits', () => {
|
|
180
|
+
test('prints completions to stdout and exits', async () => {
|
|
181
181
|
const stdout = createTestOutputStream()
|
|
182
182
|
const { cli } = buildTestCli(stdout)
|
|
183
183
|
|
|
184
184
|
// Simulate: mycli --get-goke-completions mycli dep
|
|
185
|
-
cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'dep'])
|
|
185
|
+
await cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'dep'])
|
|
186
186
|
|
|
187
187
|
// Should have printed completions to stdout
|
|
188
188
|
expect(stdout.text).toContain('deploy')
|
|
189
189
|
})
|
|
190
190
|
|
|
191
|
-
test('does not run any command action', () => {
|
|
191
|
+
test('does not run any command action', async () => {
|
|
192
192
|
const stdout = createTestOutputStream()
|
|
193
193
|
const actionSpy = vi.fn()
|
|
194
194
|
const cli = gokeTestable('mycli', { stdout })
|
|
195
195
|
.completions()
|
|
196
196
|
cli.command('deploy', 'Deploy').action(actionSpy)
|
|
197
197
|
|
|
198
|
-
cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'deploy', ''])
|
|
198
|
+
await cli.parse(['node', 'bin', '--get-goke-completions', 'mycli', 'deploy', ''])
|
|
199
199
|
|
|
200
200
|
expect(actionSpy).not.toHaveBeenCalled()
|
|
201
201
|
})
|
|
202
202
|
})
|
|
203
203
|
|
|
204
204
|
describe('generateCompletionScript', () => {
|
|
205
|
-
test('zsh template has #compdef header', () => {
|
|
205
|
+
test('zsh template has #compdef header', async () => {
|
|
206
206
|
const script = generateCompletionScript('zsh', 'my-cli', '/usr/local/bin/my-cli')
|
|
207
207
|
|
|
208
208
|
expect(script).toContain('#compdef my-cli')
|
|
@@ -211,7 +211,7 @@ describe('generateCompletionScript', () => {
|
|
|
211
211
|
expect(script).toContain('_my_cli_completions')
|
|
212
212
|
})
|
|
213
213
|
|
|
214
|
-
test('bash template has complete command', () => {
|
|
214
|
+
test('bash template has complete command', async () => {
|
|
215
215
|
const script = generateCompletionScript('bash', 'my-cli', '/usr/local/bin/my-cli')
|
|
216
216
|
|
|
217
217
|
expect(script).toContain('complete -o bashdefault')
|
|
@@ -220,13 +220,13 @@ describe('generateCompletionScript', () => {
|
|
|
220
220
|
expect(script).toContain('_my_cli_completions')
|
|
221
221
|
})
|
|
222
222
|
|
|
223
|
-
test('uses cliName as fallback path when cliPath not provided', () => {
|
|
223
|
+
test('uses cliName as fallback path when cliPath not provided', async () => {
|
|
224
224
|
const script = generateCompletionScript('zsh', 'my-cli')
|
|
225
225
|
|
|
226
226
|
expect(script).toContain('my-cli --get-goke-completions')
|
|
227
227
|
})
|
|
228
228
|
|
|
229
|
-
test('escapes special characters in function names', () => {
|
|
229
|
+
test('escapes special characters in function names', async () => {
|
|
230
230
|
const script = generateCompletionScript('zsh', 'my-cli.js', './my-cli.js')
|
|
231
231
|
|
|
232
232
|
// Function name should use underscores
|
|
@@ -237,24 +237,24 @@ describe('generateCompletionScript', () => {
|
|
|
237
237
|
})
|
|
238
238
|
|
|
239
239
|
describe('completions commands', () => {
|
|
240
|
-
test('completions script prints zsh script', () => {
|
|
240
|
+
test('completions script prints zsh script', async () => {
|
|
241
241
|
process.env.SHELL = '/bin/zsh'
|
|
242
242
|
const stdout = createTestOutputStream()
|
|
243
243
|
const cli = gokeTestable('mycli', { stdout })
|
|
244
244
|
.completions()
|
|
245
245
|
|
|
246
|
-
cli.parse(['node', 'bin', 'completions', 'script'])
|
|
246
|
+
await cli.parse(['node', 'bin', 'completions', 'script'])
|
|
247
247
|
|
|
248
248
|
expect(stdout.text).toContain('#compdef mycli')
|
|
249
249
|
expect(stdout.text).toContain('--get-goke-completions')
|
|
250
250
|
})
|
|
251
251
|
|
|
252
|
-
test('completions script prints bash script with --shell', () => {
|
|
252
|
+
test('completions script prints bash script with --shell', async () => {
|
|
253
253
|
const stdout = createTestOutputStream()
|
|
254
254
|
const cli = gokeTestable('mycli', { stdout })
|
|
255
255
|
.completions()
|
|
256
256
|
|
|
257
|
-
cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'bash'])
|
|
257
|
+
await cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'bash'])
|
|
258
258
|
|
|
259
259
|
expect(stdout.text).toContain('complete -o bashdefault')
|
|
260
260
|
expect(stdout.text).toContain('--get-goke-completions')
|
|
@@ -265,7 +265,7 @@ describe('completions commands', () => {
|
|
|
265
265
|
const cli = gokeTestable('mycli', { stderr })
|
|
266
266
|
.completions()
|
|
267
267
|
|
|
268
|
-
cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'fish'])
|
|
268
|
+
await cli.parse(['node', 'bin', 'completions', 'script', '--shell', 'fish'])
|
|
269
269
|
// The error is caught by handleCliError and printed to stderr
|
|
270
270
|
// Wait a tick for the sync action to complete
|
|
271
271
|
await new Promise((r) => setTimeout(r, 10))
|
|
@@ -289,7 +289,7 @@ describe('GOKE_COMPLETION_SHELL env var', () => {
|
|
|
289
289
|
else delete process.env.GOKE_COMPLETION_SHELL
|
|
290
290
|
})
|
|
291
291
|
|
|
292
|
-
test('uses GOKE_COMPLETION_SHELL over SHELL for format detection', () => {
|
|
292
|
+
test('uses GOKE_COMPLETION_SHELL over SHELL for format detection', async () => {
|
|
293
293
|
// Login shell is zsh but the bash shim sets GOKE_COMPLETION_SHELL=bash
|
|
294
294
|
process.env.SHELL = '/bin/zsh'
|
|
295
295
|
process.env.GOKE_COMPLETION_SHELL = 'bash'
|
|
@@ -302,12 +302,12 @@ describe('GOKE_COMPLETION_SHELL env var', () => {
|
|
|
302
302
|
}
|
|
303
303
|
})
|
|
304
304
|
|
|
305
|
-
test('zsh template sets GOKE_COMPLETION_SHELL=zsh', () => {
|
|
305
|
+
test('zsh template sets GOKE_COMPLETION_SHELL=zsh', async () => {
|
|
306
306
|
const script = generateCompletionScript('zsh', 'mycli')
|
|
307
307
|
expect(script).toContain('GOKE_COMPLETION_SHELL=zsh')
|
|
308
308
|
})
|
|
309
309
|
|
|
310
|
-
test('bash template sets GOKE_COMPLETION_SHELL=bash', () => {
|
|
310
|
+
test('bash template sets GOKE_COMPLETION_SHELL=bash', async () => {
|
|
311
311
|
const script = generateCompletionScript('bash', 'mycli')
|
|
312
312
|
expect(script).toContain('GOKE_COMPLETION_SHELL=bash')
|
|
313
313
|
})
|
|
@@ -327,7 +327,7 @@ describe('option value position', () => {
|
|
|
327
327
|
else delete process.env.SHELL
|
|
328
328
|
})
|
|
329
329
|
|
|
330
|
-
test('returns empty when previous token is a value-taking option', () => {
|
|
330
|
+
test('returns empty when previous token is a value-taking option', async () => {
|
|
331
331
|
const { cli } = buildTestCli()
|
|
332
332
|
// mycli deploy --env <TAB> — should not suggest flags
|
|
333
333
|
const completions = cli.getCompletions(['mycli', 'deploy', '--env', ''])
|
|
@@ -335,7 +335,7 @@ describe('option value position', () => {
|
|
|
335
335
|
expect(completions).toEqual([])
|
|
336
336
|
})
|
|
337
337
|
|
|
338
|
-
test('still suggests flags when previous token is a boolean option', () => {
|
|
338
|
+
test('still suggests flags when previous token is a boolean option', async () => {
|
|
339
339
|
const { cli } = buildTestCli()
|
|
340
340
|
// mycli deploy --dry-run <TAB> — boolean flag, should still suggest
|
|
341
341
|
const completions = cli.getCompletions(['mycli', 'deploy', '--dry-run', '--'])
|
|
@@ -358,7 +358,7 @@ describe('default command options', () => {
|
|
|
358
358
|
else delete process.env.SHELL
|
|
359
359
|
})
|
|
360
360
|
|
|
361
|
-
test('includes default command options at root level', () => {
|
|
361
|
+
test('includes default command options at root level', async () => {
|
|
362
362
|
const cli = gokeTestable('mycli')
|
|
363
363
|
.help()
|
|
364
364
|
.completions()
|
|
@@ -389,7 +389,7 @@ describe('alias suppression', () => {
|
|
|
389
389
|
else delete process.env.SHELL
|
|
390
390
|
})
|
|
391
391
|
|
|
392
|
-
test('suppresses --dry-run when -d alias was already used', () => {
|
|
392
|
+
test('suppresses --dry-run when -d alias was already used', async () => {
|
|
393
393
|
const cli = gokeTestable('mycli')
|
|
394
394
|
.completions()
|
|
395
395
|
|
|
@@ -453,7 +453,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
453
453
|
return cli
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
test('app <TAB> — empty after CLI name', () => {
|
|
456
|
+
test('app <TAB> — empty after CLI name', async () => {
|
|
457
457
|
const cli = buildRootCli()
|
|
458
458
|
expect(cli.getCompletions(['app', ''])).toMatchInlineSnapshot(`
|
|
459
459
|
[
|
|
@@ -464,7 +464,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
464
464
|
`)
|
|
465
465
|
})
|
|
466
466
|
|
|
467
|
-
test('app i<TAB> — partial command', () => {
|
|
467
|
+
test('app i<TAB> — partial command', async () => {
|
|
468
468
|
const cli = buildRootCli()
|
|
469
469
|
expect(cli.getCompletions(['app', 'i'])).toMatchInlineSnapshot(`
|
|
470
470
|
[
|
|
@@ -473,7 +473,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
473
473
|
`)
|
|
474
474
|
})
|
|
475
475
|
|
|
476
|
-
test('app --<TAB> — flags at root level', () => {
|
|
476
|
+
test('app --<TAB> — flags at root level', async () => {
|
|
477
477
|
const cli = buildRootCli()
|
|
478
478
|
expect(cli.getCompletions(['app', '--'])).toMatchInlineSnapshot(`
|
|
479
479
|
[
|
|
@@ -485,7 +485,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
485
485
|
`)
|
|
486
486
|
})
|
|
487
487
|
|
|
488
|
-
test('app --p<TAB> — partial flag', () => {
|
|
488
|
+
test('app --p<TAB> — partial flag', async () => {
|
|
489
489
|
const cli = buildRootCli()
|
|
490
490
|
expect(cli.getCompletions(['app', '--p'])).toMatchInlineSnapshot(`
|
|
491
491
|
[
|
|
@@ -494,12 +494,12 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
494
494
|
`)
|
|
495
495
|
})
|
|
496
496
|
|
|
497
|
-
test('app --port <TAB> — after value-taking option', () => {
|
|
497
|
+
test('app --port <TAB> — after value-taking option', async () => {
|
|
498
498
|
const cli = buildRootCli()
|
|
499
499
|
expect(cli.getCompletions(['app', '--port', ''])).toMatchInlineSnapshot(`[]`)
|
|
500
500
|
})
|
|
501
501
|
|
|
502
|
-
test('app --verbose <TAB> — after boolean flag', () => {
|
|
502
|
+
test('app --verbose <TAB> — after boolean flag', async () => {
|
|
503
503
|
const cli = buildRootCli()
|
|
504
504
|
expect(cli.getCompletions(['app', '--verbose', ''])).toMatchInlineSnapshot(`
|
|
505
505
|
[
|
|
@@ -508,7 +508,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
508
508
|
`)
|
|
509
509
|
})
|
|
510
510
|
|
|
511
|
-
test('app --verbose --<TAB> — more flags after boolean', () => {
|
|
511
|
+
test('app --verbose --<TAB> — more flags after boolean', async () => {
|
|
512
512
|
const cli = buildRootCli()
|
|
513
513
|
expect(cli.getCompletions(['app', '--verbose', '--'])).toMatchInlineSnapshot(`
|
|
514
514
|
[
|
|
@@ -520,7 +520,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
520
520
|
`)
|
|
521
521
|
})
|
|
522
522
|
|
|
523
|
-
test('app init <TAB> — after named command', () => {
|
|
523
|
+
test('app init <TAB> — after named command', async () => {
|
|
524
524
|
const cli = buildRootCli()
|
|
525
525
|
expect(cli.getCompletions(['app', 'init', ''])).toMatchInlineSnapshot(`
|
|
526
526
|
[
|
|
@@ -531,7 +531,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
531
531
|
`)
|
|
532
532
|
})
|
|
533
533
|
|
|
534
|
-
test('app init --<TAB> — flags for named command', () => {
|
|
534
|
+
test('app init --<TAB> — flags for named command', async () => {
|
|
535
535
|
const cli = buildRootCli()
|
|
536
536
|
expect(cli.getCompletions(['app', 'init', '--'])).toMatchInlineSnapshot(`
|
|
537
537
|
[
|
|
@@ -542,7 +542,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
542
542
|
`)
|
|
543
543
|
})
|
|
544
544
|
|
|
545
|
-
test('app init --force --<TAB> — remaining flags after used boolean', () => {
|
|
545
|
+
test('app init --force --<TAB> — remaining flags after used boolean', async () => {
|
|
546
546
|
const cli = buildRootCli()
|
|
547
547
|
expect(cli.getCompletions(['app', 'init', '--force', '--'])).toMatchInlineSnapshot(`
|
|
548
548
|
[
|
|
@@ -552,12 +552,12 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
552
552
|
`)
|
|
553
553
|
})
|
|
554
554
|
|
|
555
|
-
test('app init --template <TAB> — after value-taking flag', () => {
|
|
555
|
+
test('app init --template <TAB> — after value-taking flag', async () => {
|
|
556
556
|
const cli = buildRootCli()
|
|
557
557
|
expect(cli.getCompletions(['app', 'init', '--template', ''])).toMatchInlineSnapshot(`[]`)
|
|
558
558
|
})
|
|
559
559
|
|
|
560
|
-
test('app config <TAB> — namespace with subcommands', () => {
|
|
560
|
+
test('app config <TAB> — namespace with subcommands', async () => {
|
|
561
561
|
const cli = buildRootCli()
|
|
562
562
|
expect(cli.getCompletions(['app', 'config', ''])).toMatchInlineSnapshot(`
|
|
563
563
|
[
|
|
@@ -568,7 +568,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
568
568
|
`)
|
|
569
569
|
})
|
|
570
570
|
|
|
571
|
-
test('app config s<TAB> — partial subcommand', () => {
|
|
571
|
+
test('app config s<TAB> — partial subcommand', async () => {
|
|
572
572
|
const cli = buildRootCli()
|
|
573
573
|
expect(cli.getCompletions(['app', 'config', 's'])).toMatchInlineSnapshot(`
|
|
574
574
|
[
|
|
@@ -577,7 +577,7 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
577
577
|
`)
|
|
578
578
|
})
|
|
579
579
|
|
|
580
|
-
test('app config list --<TAB> — flags for nested subcommand', () => {
|
|
580
|
+
test('app config list --<TAB> — flags for nested subcommand', async () => {
|
|
581
581
|
const cli = buildRootCli()
|
|
582
582
|
expect(cli.getCompletions(['app', 'config', 'list', '--'])).toMatchInlineSnapshot(`
|
|
583
583
|
[
|
|
@@ -586,12 +586,12 @@ describe('completion snapshots: CLI with root default command', () => {
|
|
|
586
586
|
`)
|
|
587
587
|
})
|
|
588
588
|
|
|
589
|
-
test('app x<TAB> — no matching command', () => {
|
|
589
|
+
test('app x<TAB> — no matching command', async () => {
|
|
590
590
|
const cli = buildRootCli()
|
|
591
591
|
expect(cli.getCompletions(['app', 'x'])).toMatchInlineSnapshot(`[]`)
|
|
592
592
|
})
|
|
593
593
|
|
|
594
|
-
test('hidden commands never appear', () => {
|
|
594
|
+
test('hidden commands never appear', async () => {
|
|
595
595
|
const cli = buildRootCli()
|
|
596
596
|
const all = cli.getCompletions(['app', ''])
|
|
597
597
|
expect(all).not.toContain('secret')
|
|
@@ -651,7 +651,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
651
651
|
return cli
|
|
652
652
|
}
|
|
653
653
|
|
|
654
|
-
test('kubectl <TAB> — top-level commands', () => {
|
|
654
|
+
test('kubectl <TAB> — top-level commands', async () => {
|
|
655
655
|
const cli = buildNamespacedCli()
|
|
656
656
|
expect(cli.getCompletions(['kubectl', ''])).toMatchInlineSnapshot(`
|
|
657
657
|
[
|
|
@@ -665,7 +665,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
665
665
|
`)
|
|
666
666
|
})
|
|
667
667
|
|
|
668
|
-
test('kubectl g<TAB> — partial match', () => {
|
|
668
|
+
test('kubectl g<TAB> — partial match', async () => {
|
|
669
669
|
const cli = buildNamespacedCli()
|
|
670
670
|
expect(cli.getCompletions(['kubectl', 'g'])).toMatchInlineSnapshot(`
|
|
671
671
|
[
|
|
@@ -674,7 +674,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
674
674
|
`)
|
|
675
675
|
})
|
|
676
676
|
|
|
677
|
-
test('kubectl --<TAB> — global options at root', () => {
|
|
677
|
+
test('kubectl --<TAB> — global options at root', async () => {
|
|
678
678
|
const cli = buildNamespacedCli()
|
|
679
679
|
expect(cli.getCompletions(['kubectl', '--'])).toMatchInlineSnapshot(`
|
|
680
680
|
[
|
|
@@ -685,12 +685,12 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
685
685
|
`)
|
|
686
686
|
})
|
|
687
687
|
|
|
688
|
-
test('kubectl --context <TAB> — after global value option', () => {
|
|
688
|
+
test('kubectl --context <TAB> — after global value option', async () => {
|
|
689
689
|
const cli = buildNamespacedCli()
|
|
690
690
|
expect(cli.getCompletions(['kubectl', '--context', ''])).toMatchInlineSnapshot(`[]`)
|
|
691
691
|
})
|
|
692
692
|
|
|
693
|
-
test('kubectl get <TAB> — subcommands under namespace', () => {
|
|
693
|
+
test('kubectl get <TAB> — subcommands under namespace', async () => {
|
|
694
694
|
const cli = buildNamespacedCli()
|
|
695
695
|
expect(cli.getCompletions(['kubectl', 'get', ''])).toMatchInlineSnapshot(`
|
|
696
696
|
[
|
|
@@ -701,7 +701,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
701
701
|
`)
|
|
702
702
|
})
|
|
703
703
|
|
|
704
|
-
test('kubectl get p<TAB> — partial subcommand', () => {
|
|
704
|
+
test('kubectl get p<TAB> — partial subcommand', async () => {
|
|
705
705
|
const cli = buildNamespacedCli()
|
|
706
706
|
expect(cli.getCompletions(['kubectl', 'get', 'p'])).toMatchInlineSnapshot(`
|
|
707
707
|
[
|
|
@@ -710,7 +710,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
710
710
|
`)
|
|
711
711
|
})
|
|
712
712
|
|
|
713
|
-
test('kubectl get pods --<TAB> — options for nested command', () => {
|
|
713
|
+
test('kubectl get pods --<TAB> — options for nested command', async () => {
|
|
714
714
|
const cli = buildNamespacedCli()
|
|
715
715
|
expect(cli.getCompletions(['kubectl', 'get', 'pods', '--'])).toMatchInlineSnapshot(`
|
|
716
716
|
[
|
|
@@ -724,7 +724,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
724
724
|
`)
|
|
725
725
|
})
|
|
726
726
|
|
|
727
|
-
test('kubectl get pods -A --<TAB> — remaining options after used flag', () => {
|
|
727
|
+
test('kubectl get pods -A --<TAB> — remaining options after used flag', async () => {
|
|
728
728
|
const cli = buildNamespacedCli()
|
|
729
729
|
expect(cli.getCompletions(['kubectl', 'get', 'pods', '-A', '--'])).toMatchInlineSnapshot(`
|
|
730
730
|
[
|
|
@@ -737,12 +737,12 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
737
737
|
`)
|
|
738
738
|
})
|
|
739
739
|
|
|
740
|
-
test('kubectl get pods --output <TAB> — after value option', () => {
|
|
740
|
+
test('kubectl get pods --output <TAB> — after value option', async () => {
|
|
741
741
|
const cli = buildNamespacedCli()
|
|
742
742
|
expect(cli.getCompletions(['kubectl', 'get', 'pods', '--output', ''])).toMatchInlineSnapshot(`[]`)
|
|
743
743
|
})
|
|
744
744
|
|
|
745
|
-
test('kubectl describe <TAB> — subcommands', () => {
|
|
745
|
+
test('kubectl describe <TAB> — subcommands', async () => {
|
|
746
746
|
const cli = buildNamespacedCli()
|
|
747
747
|
expect(cli.getCompletions(['kubectl', 'describe', ''])).toMatchInlineSnapshot(`
|
|
748
748
|
[
|
|
@@ -752,7 +752,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
752
752
|
`)
|
|
753
753
|
})
|
|
754
754
|
|
|
755
|
-
test('kubectl apply --<TAB> — options for apply', () => {
|
|
755
|
+
test('kubectl apply --<TAB> — options for apply', async () => {
|
|
756
756
|
const cli = buildNamespacedCli()
|
|
757
757
|
expect(cli.getCompletions(['kubectl', 'apply', '--'])).toMatchInlineSnapshot(`
|
|
758
758
|
[
|
|
@@ -765,7 +765,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
765
765
|
`)
|
|
766
766
|
})
|
|
767
767
|
|
|
768
|
-
test('kubectl apply --dry-run --<TAB> — after used boolean', () => {
|
|
768
|
+
test('kubectl apply --dry-run --<TAB> — after used boolean', async () => {
|
|
769
769
|
const cli = buildNamespacedCli()
|
|
770
770
|
expect(cli.getCompletions(['kubectl', 'apply', '--dry-run', '--'])).toMatchInlineSnapshot(`
|
|
771
771
|
[
|
|
@@ -777,7 +777,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
777
777
|
`)
|
|
778
778
|
})
|
|
779
779
|
|
|
780
|
-
test('kubectl delete pod myapp --<TAB> — options after positional arg', () => {
|
|
780
|
+
test('kubectl delete pod myapp --<TAB> — options after positional arg', async () => {
|
|
781
781
|
const cli = buildNamespacedCli()
|
|
782
782
|
expect(cli.getCompletions(['kubectl', 'delete', 'pod', 'myapp', '--'])).toMatchInlineSnapshot(`
|
|
783
783
|
[
|
|
@@ -790,7 +790,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
790
790
|
`)
|
|
791
791
|
})
|
|
792
792
|
|
|
793
|
-
test('kubectl logs mypod --<TAB> — options for logs', () => {
|
|
793
|
+
test('kubectl logs mypod --<TAB> — options for logs', async () => {
|
|
794
794
|
const cli = buildNamespacedCli()
|
|
795
795
|
expect(cli.getCompletions(['kubectl', 'logs', 'mypod', '--'])).toMatchInlineSnapshot(`
|
|
796
796
|
[
|
|
@@ -803,7 +803,7 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
803
803
|
`)
|
|
804
804
|
})
|
|
805
805
|
|
|
806
|
-
test('kubectl logs mypod -f --<TAB> — after short boolean alias', () => {
|
|
806
|
+
test('kubectl logs mypod -f --<TAB> — after short boolean alias', async () => {
|
|
807
807
|
const cli = buildNamespacedCli()
|
|
808
808
|
expect(cli.getCompletions(['kubectl', 'logs', 'mypod', '-f', '--'])).toMatchInlineSnapshot(`
|
|
809
809
|
[
|
|
@@ -815,12 +815,12 @@ describe('completion snapshots: CLI with namespaced commands (no root)', () => {
|
|
|
815
815
|
`)
|
|
816
816
|
})
|
|
817
817
|
|
|
818
|
-
test('kubectl logs mypod --tail <TAB> — after value option', () => {
|
|
818
|
+
test('kubectl logs mypod --tail <TAB> — after value option', async () => {
|
|
819
819
|
const cli = buildNamespacedCli()
|
|
820
820
|
expect(cli.getCompletions(['kubectl', 'logs', 'mypod', '--tail', ''])).toMatchInlineSnapshot(`[]`)
|
|
821
821
|
})
|
|
822
822
|
|
|
823
|
-
test('kubectl nonexistent <TAB> — unknown command', () => {
|
|
823
|
+
test('kubectl nonexistent <TAB> — unknown command', async () => {
|
|
824
824
|
const cli = buildNamespacedCli()
|
|
825
825
|
expect(cli.getCompletions(['kubectl', 'nonexistent', ''])).toMatchInlineSnapshot(`
|
|
826
826
|
[
|
|
@@ -866,7 +866,7 @@ describe('completion snapshots: zsh format', () => {
|
|
|
866
866
|
return cli
|
|
867
867
|
}
|
|
868
868
|
|
|
869
|
-
test('todo <TAB> — commands with descriptions', () => {
|
|
869
|
+
test('todo <TAB> — commands with descriptions', async () => {
|
|
870
870
|
const cli = buildZshCli()
|
|
871
871
|
expect(cli.getCompletions(['todo', ''])).toMatchInlineSnapshot(`
|
|
872
872
|
[
|
|
@@ -878,7 +878,7 @@ describe('completion snapshots: zsh format', () => {
|
|
|
878
878
|
`)
|
|
879
879
|
})
|
|
880
880
|
|
|
881
|
-
test('todo add myitem --<TAB> — options with descriptions', () => {
|
|
881
|
+
test('todo add myitem --<TAB> — options with descriptions', async () => {
|
|
882
882
|
const cli = buildZshCli()
|
|
883
883
|
expect(cli.getCompletions(['todo', 'add', 'myitem', '--'])).toMatchInlineSnapshot(`
|
|
884
884
|
[
|
|
@@ -889,7 +889,7 @@ describe('completion snapshots: zsh format', () => {
|
|
|
889
889
|
`)
|
|
890
890
|
})
|
|
891
891
|
|
|
892
|
-
test('todo list --<TAB> — list options with descriptions', () => {
|
|
892
|
+
test('todo list --<TAB> — list options with descriptions', async () => {
|
|
893
893
|
const cli = buildZshCli()
|
|
894
894
|
expect(cli.getCompletions(['todo', 'list', '--'])).toMatchInlineSnapshot(`
|
|
895
895
|
[
|