-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(cli): add @bomb.sh/tab completions #8639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e7b055b
ee0b7d1
65a7711
60438ab
55c98b4
64255a6
378b9e6
f48d105
2c17846
e73f720
fb31d39
d7277b7
7f0ccae
d9eeed4
39bab22
860f9e4
df49a27
8acfa84
0d969ce
b0c1db2
20ee067
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import { normalize } from 'pathe' | |
| import c from 'tinyrainbow' | ||
| import { version } from '../../../package.json' with { type: 'json' } | ||
| import { benchCliOptionsConfig, cliOptionsConfig, collectCliOptionsConfig } from './cli-config' | ||
| import { setupTabCompletions } from './completions' | ||
|
|
||
| function addCommand(cli: CAC | Command, name: string, option: CLIOption<any>) { | ||
| const commandName = option.alias || name | ||
|
|
@@ -195,6 +196,7 @@ export function createCLI(options: CliParseOptions = {}): CAC { | |
| .command('[...filters]', undefined, options) | ||
| .action((filters, options) => start('test', filters, options)) | ||
|
|
||
| setupTabCompletions(cli) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it async?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is, but that's intentional here. I wanted to keep |
||
| return cli | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import type { CAC } from 'cac' | ||
| import tab from '@bomb.sh/tab/cac' | ||
|
|
||
| export async function setupTabCompletions(cli: CAC): Promise<void> { | ||
AmirSa12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await tab(cli, { | ||
| subCommands: {}, | ||
| options: { | ||
| environment(complete) { | ||
| complete('node', 'Node.js environment') | ||
| complete('jsdom', 'JSDOM environment') | ||
| complete('happy-dom', 'Happy DOM environment') | ||
| complete('edge-runtime', 'Edge runtime environment') | ||
| }, | ||
| pool(complete) { | ||
| complete('threads', 'Threads pool') | ||
| complete('forks', 'Forks pool') | ||
| complete('vmThreads', 'VM threads pool') | ||
| complete('vmForks', 'VM forks pool') | ||
| }, | ||
| reporter(complete) { | ||
| complete('default', 'Default reporter') | ||
| complete('verbose', 'Verbose reporter') | ||
| complete('dot', 'Dot reporter') | ||
| complete('json', 'JSON reporter') | ||
| complete('junit', 'JUnit reporter') | ||
| complete('html', 'HTML reporter') | ||
| complete('tap', 'TAP reporter') | ||
| complete('tap-flat', 'TAP flat reporter') | ||
| complete('hanging-process', 'Hanging process reporter') | ||
| }, | ||
| 'coverage.reporter': function (complete) { | ||
| complete('text', 'Text coverage reporter') | ||
| complete('html', 'HTML coverage reporter') | ||
| complete('clover', 'Clover coverage reporter') | ||
| complete('json', 'JSON coverage reporter') | ||
| complete('json-summary', 'JSON summary coverage reporter') | ||
| complete('lcov', 'LCOV coverage reporter') | ||
| complete('lcovonly', 'LCOV only coverage reporter') | ||
| complete('teamcity', 'TeamCity coverage reporter') | ||
| complete('cobertura', 'Cobertura coverage reporter') | ||
| }, | ||
| 'browser.name': function (complete) { | ||
| complete('chromium', 'Chromium') | ||
| complete('firefox', 'Mozilla Firefox') | ||
| complete('safari', 'Safari') | ||
| complete('chrome', 'Google Chrome') | ||
| complete('edge', 'Microsoft Edge') | ||
| }, | ||
| silent(complete) { | ||
| complete('true', 'Enable silent mode') | ||
| complete('false', 'Disable silent mode') | ||
| complete('passed-only', 'Show logs from failing tests only') | ||
| }, | ||
| }, | ||
| }) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.