fix: standardize slash command help and error messages (#999)

This commit is contained in:
jnjpng
2026-02-18 16:06:54 -08:00
committed by GitHub
parent b322a46a43
commit f3aa3291db
3 changed files with 185 additions and 22 deletions

View File

@@ -617,13 +617,36 @@ export async function handleDisconnect(
const parts = msg.trim().split(/\s+/);
const provider = parts[1]?.toLowerCase();
// /disconnect help
if (provider === "help") {
addCommandResult(
ctx.buffersRef,
ctx.refreshDerived,
msg,
[
"/disconnect help",
"",
"Disconnect an existing account.",
"",
"USAGE",
" /disconnect <provider> — disconnect a provider",
" /disconnect help — show this help",
"",
"PROVIDERS",
" codex, claude, zai, minimax, openrouter, bedrock",
].join("\n"),
true,
);
return;
}
// If no provider specified, show usage
if (!provider) {
addCommandResult(
ctx.buffersRef,
ctx.refreshDerived,
msg,
"Usage: /disconnect <provider>\n\nAvailable providers: codex, claude, zai, minimax, openrouter, bedrock",
"Usage: /disconnect <provider>",
false,
);
return;
@@ -670,7 +693,7 @@ export async function handleDisconnect(
ctx.buffersRef,
ctx.refreshDerived,
msg,
`Error: Unknown provider "${provider}"\n\nAvailable providers: codex, claude, zai, minimax, openrouter, bedrock\nUsage: /disconnect <provider>`,
`Unknown provider: "${provider}". Run /disconnect help for usage.`,
false,
);
}

View File

@@ -274,6 +274,19 @@ export const commands: Record<string, Command> = {
desc: "Setup terminal shortcuts [--revert]",
order: 37,
handler: async (args: string[]) => {
if (args.includes("help")) {
return [
"/terminal help",
"",
"Setup terminal keyboard shortcuts.",
"",
"USAGE",
" /terminal — install Shift+Enter keybinding",
" /terminal --revert — remove keybinding",
" /terminal help — show this help",
].join("\n");
}
const {
detectTerminalType,
getKeybindingsPath,