@@ -2,84 +2,83 @@ import type { CommandDef } from 'citty'
22import tab from '@bomb.sh/tab/citty'
33
44export async function initCompletions ( command : CommandDef ) {
5- const completion = await tab ( command as any )
5+ const completion = await tab ( command as any )
66
7- const devCommand = completion . commands . get ( 'dev' )
8- if ( devCommand ) {
9- const portOption = devCommand . options . get ( 'port' )
10- if ( portOption ) {
11- portOption . handler = ( complete ) => {
12- complete ( '3000' , 'Default development port' )
13- complete ( '3001' , 'Alternative port' )
14- complete ( '8080' , 'Common alternative port' )
15- }
16- }
7+ const devCommand = completion . commands . get ( 'dev' )
8+ if ( devCommand ) {
9+ const portOption = devCommand . options . get ( 'port' )
10+ if ( portOption ) {
11+ portOption . handler = ( complete ) => {
12+ complete ( '3000' , 'Default development port' )
13+ complete ( '3001' , 'Alternative port' )
14+ complete ( '8080' , 'Common alternative port' )
15+ }
16+ }
1717
18- const hostOption = devCommand . options . get ( 'host' )
19- if ( hostOption ) {
20- hostOption . handler = ( complete ) => {
21- complete ( 'localhost' , 'Local development' )
22- complete ( '0.0.0.0' , 'Listen on all interfaces' )
23- complete ( '127.0.0.1' , 'Loopback address' )
24- }
25- }
18+ const hostOption = devCommand . options . get ( 'host' )
19+ if ( hostOption ) {
20+ hostOption . handler = ( complete ) => {
21+ complete ( 'localhost' , 'Local development' )
22+ complete ( '0.0.0.0' , 'Listen on all interfaces' )
23+ complete ( '127.0.0.1' , 'Loopback address' )
24+ }
2625 }
26+ }
2727
28- const buildCommand = completion . commands . get ( 'build' )
29- if ( buildCommand ) {
30- const presetOption = buildCommand . options . get ( 'preset' )
31- if ( presetOption ) {
32- presetOption . handler = ( complete ) => {
33- complete ( 'node-server' , 'Node.js server' )
34- complete ( 'static' , 'Static hosting' )
35- complete ( 'cloudflare-pages' , 'Cloudflare Pages' )
36- complete ( 'vercel' , 'Vercel' )
37- complete ( 'netlify' , 'Netlify' )
38- complete ( 'aws-lambda' , 'AWS Lambda' )
39- complete ( 'azure' , 'Azure' )
40- complete ( 'firebase' , 'Firebase' )
41- complete ( 'deno-deploy' , 'Deno Deploy' )
42- complete ( 'bun' , 'Bun runtime' )
43- }
44- }
28+ const buildCommand = completion . commands . get ( 'build' )
29+ if ( buildCommand ) {
30+ const presetOption = buildCommand . options . get ( 'preset' )
31+ if ( presetOption ) {
32+ presetOption . handler = ( complete ) => {
33+ complete ( 'node-server' , 'Node.js server' )
34+ complete ( 'static' , 'Static hosting' )
35+ complete ( 'cloudflare-pages' , 'Cloudflare Pages' )
36+ complete ( 'vercel' , 'Vercel' )
37+ complete ( 'netlify' , 'Netlify' )
38+ complete ( 'aws-lambda' , 'AWS Lambda' )
39+ complete ( 'azure' , 'Azure' )
40+ complete ( 'firebase' , 'Firebase' )
41+ complete ( 'deno-deploy' , 'Deno Deploy' )
42+ complete ( 'bun' , 'Bun runtime' )
43+ }
4544 }
45+ }
4646
47- const initCommand = completion . commands . get ( 'init' )
48- if ( initCommand ) {
49- const templateOption = initCommand . options . get ( 'template' )
50- if ( templateOption ) {
51- templateOption . handler = ( complete ) => {
52- complete ( 'v3' , 'Nuxt 3 template' )
53- complete ( 'v4' , 'Nuxt 4 template' )
54- }
55- }
47+ const initCommand = completion . commands . get ( 'init' )
48+ if ( initCommand ) {
49+ const templateOption = initCommand . options . get ( 'template' )
50+ if ( templateOption ) {
51+ templateOption . handler = ( complete ) => {
52+ complete ( 'v3' , 'Nuxt 3 template' )
53+ complete ( 'v4' , 'Nuxt 4 template' )
54+ }
5655 }
56+ }
5757
58- const addCommand = completion . commands . get ( 'add' )
59- if ( addCommand ) {
60- const cwdOption = addCommand . options . get ( 'cwd' )
61- if ( cwdOption ) {
62- cwdOption . handler = ( complete ) => {
63- complete ( '.' , 'Current directory' )
64- }
65- }
58+ const addCommand = completion . commands . get ( 'add' )
59+ if ( addCommand ) {
60+ const cwdOption = addCommand . options . get ( 'cwd' )
61+ if ( cwdOption ) {
62+ cwdOption . handler = ( complete ) => {
63+ complete ( '.' , 'Current directory' )
64+ }
6665 }
66+ }
6767
68- const logLevelCommands = [ 'dev' , 'build' , 'generate' , 'preview' , 'prepare' ]
69- for ( const cmdName of logLevelCommands ) {
70- const cmd = completion . commands . get ( cmdName )
71- if ( cmd ) {
72- const logLevelOption = cmd . options . get ( 'logLevel' )
73- if ( logLevelOption ) {
74- logLevelOption . handler = ( complete ) => {
75- complete ( 'silent' , 'No logs' )
76- complete ( 'info' , 'Standard logging' )
77- complete ( 'verbose' , 'Detailed logging' )
78- }
79- }
68+ const logLevelCommands = [ 'dev' , 'build' , 'generate' , 'preview' , 'prepare' ]
69+ for ( const cmdName of logLevelCommands ) {
70+ const cmd = completion . commands . get ( cmdName )
71+ if ( cmd ) {
72+ const logLevelOption = cmd . options . get ( 'logLevel' )
73+ if ( logLevelOption ) {
74+ logLevelOption . handler = ( complete ) => {
75+ complete ( 'silent' , 'No logs' )
76+ complete ( 'info' , 'Standard logging' )
77+ complete ( 'verbose' , 'Detailed logging' )
8078 }
79+ }
8180 }
81+ }
8282
83- return completion
83+ return completion
8484}
85-
0 commit comments