mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-15 20:40:35 -07:00
Text can be added after /plan command (#22833)
This commit is contained in:
@@ -33,6 +33,7 @@ export const parseSlashCommand = (
|
||||
let commandToExecute: SlashCommand | undefined;
|
||||
let pathIndex = 0;
|
||||
const canonicalPath: string[] = [];
|
||||
let parentCommand: SlashCommand | undefined;
|
||||
|
||||
for (const part of commandPath) {
|
||||
// TODO: For better performance and architectural clarity, this two-pass
|
||||
@@ -52,6 +53,7 @@ export const parseSlashCommand = (
|
||||
}
|
||||
|
||||
if (foundCommand) {
|
||||
parentCommand = commandToExecute;
|
||||
commandToExecute = foundCommand;
|
||||
canonicalPath.push(foundCommand.name);
|
||||
pathIndex++;
|
||||
@@ -67,5 +69,21 @@ export const parseSlashCommand = (
|
||||
|
||||
const args = parts.slice(pathIndex).join(' ');
|
||||
|
||||
// Backtrack if the matched (sub)command doesn't take arguments but some were provided,
|
||||
// AND the parent command is capable of handling them.
|
||||
if (
|
||||
commandToExecute &&
|
||||
commandToExecute.takesArgs === false &&
|
||||
args.length > 0 &&
|
||||
parentCommand &&
|
||||
parentCommand.action
|
||||
) {
|
||||
return {
|
||||
commandToExecute: parentCommand,
|
||||
args: parts.slice(pathIndex - 1).join(' '),
|
||||
canonicalPath: canonicalPath.slice(0, -1),
|
||||
};
|
||||
}
|
||||
|
||||
return { commandToExecute, args, canonicalPath };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user