···11-import * as zsh from "./zsh";
22-import * as bash from "./bash";
33-import * as fish from "./fish";
44-import * as powershell from "./powershell";
55-import type { CAC } from "cac";
66-import { Completion } from "./";
11+import * as zsh from './zsh';
22+import * as bash from './bash';
33+import * as fish from './fish';
44+import * as powershell from './powershell';
55+import type { CAC } from 'cac';
66+import { Completion } from './';
7788const execPath = process.execPath;
99const processArgs = process.argv.slice(1);
···1111const quotedProcessArgs = processArgs.map(quoteIfNeeded);
1212const quotedProcessExecArgs = process.execArgv.map(quoteIfNeeded);
13131414-const x = `${quotedExecPath} ${quotedProcessExecArgs.join(" ")} ${quotedProcessArgs[0]}`;
1414+const x = `${quotedExecPath} ${quotedProcessExecArgs.join(' ')} ${quotedProcessArgs[0]}`;
15151616function quoteIfNeeded(path: string): string {
1717- return path.includes(" ") ? `'${path}'` : path;
1717+ return path.includes(' ') ? `'${path}'` : path;
1818}
19192020// export default function tab(instance: CAC): void {
···300300 if (cmd.name === 'complete') continue; // Skip completion command
301301302302 // Get positional args info from command usage
303303- const args = (cmd.rawName.match(/\[.*?\]|\<.*?\>/g) || [])
304304- .map(arg => arg.startsWith('[')); // true if optional (wrapped in [])
303303+ const args = (cmd.rawName.match(/\[.*?\]|\<.*?\>/g) || []).map((arg) =>
304304+ arg.startsWith('[')
305305+ ); // true if optional (wrapped in [])
305306306307 // Add command to completion
307308 const commandName = completion.addCommand(
···322323 }
323324 }
324325325325- instance.command("complete [shell]").action(async (shell, extra) => {
326326+ instance.command('complete [shell]').action(async (shell, extra) => {
326327 switch (shell) {
327327- case "zsh": {
328328+ case 'zsh': {
328329 const script = zsh.generate(instance.name, x);
329330 console.log(script);
330331 break;
331332 }
332332- case "bash": {
333333+ case 'bash': {
333334 const script = bash.generate(instance.name, x);
334335 console.log(script);
335336 break;
336337 }
337337- case "fish": {
338338+ case 'fish': {
338339 const script = fish.generate(instance.name, x);
339340 console.log(script);
340341 break;
341342 }
342342- case "powershell": {
343343+ case 'powershell': {
343344 const script = powershell.generate(instance.name, x);
344345 console.log(script);
345346 break;
346347 }
347348 default: {
348348- const args: string[] = extra["--"];
349349+ const args: string[] = extra['--'];
349350 instance.showHelpOnExit = false;
350351351352 // Parse current command context
···363364 });
364365365366 return completion;
366366-}367367+}
+5-5
src/citty.ts
···11-import { ArgDef, defineCommand, parseArgs } from 'citty';
11+import { ArgDef, defineCommand } from 'citty';
22import * as zsh from './zsh';
33import * as bash from './bash';
44import * as fish from './fish';
···160160 break;
161161 }
162162 default: {
163163- const args = (await resolve(instance.args))!;
164164- const parsed = parseArgs(extra, args);
163163+ // const args = (await resolve(instance.args))!;
164164+ // const parsed = parseArgs(extra, args);
165165 // TODO: this is not ideal at all
166166- const matchedCommand = parsed._.join(' ').trim();
166166+ // const matchedCommand = parsed._.join(' ').trim(); //TODO: this was passed to parse line 170
167167 // TODO: `command lint i` does not work because `lint` and `i` are potential commands
168168 // instead the potential command should only be `lint`
169169 // and `i` is the to be completed part
170170- return completion.parse(extra, matchedCommand);
170170+ return completion.parse(extra);
171171 }
172172 }
173173 },