feat(tui): add /elev alias
This commit is contained in:
@@ -11,11 +11,19 @@ export type ParsedCommand = {
|
||||
args: string;
|
||||
};
|
||||
|
||||
const COMMAND_ALIASES: Record<string, string> = {
|
||||
elev: "elevated",
|
||||
};
|
||||
|
||||
export function parseCommand(input: string): ParsedCommand {
|
||||
const trimmed = input.replace(/^\//, "").trim();
|
||||
if (!trimmed) return { name: "", args: "" };
|
||||
const [name, ...rest] = trimmed.split(/\s+/);
|
||||
return { name: name.toLowerCase(), args: rest.join(" ").trim() };
|
||||
const normalized = name.toLowerCase();
|
||||
return {
|
||||
name: COMMAND_ALIASES[normalized] ?? normalized,
|
||||
args: rest.join(" ").trim(),
|
||||
};
|
||||
}
|
||||
|
||||
export function getSlashCommands(): SlashCommand[] {
|
||||
@@ -53,6 +61,14 @@ export function getSlashCommands(): SlashCommand[] {
|
||||
(value) => ({ value, label: value }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "elev",
|
||||
description: "Alias for /elevated",
|
||||
getArgumentCompletions: (prefix) =>
|
||||
ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map(
|
||||
(value) => ({ value, label: value }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "activation",
|
||||
description: "Set group activation",
|
||||
@@ -88,6 +104,7 @@ export function helpText(): string {
|
||||
"/think <off|minimal|low|medium|high>",
|
||||
"/verbose <on|off>",
|
||||
"/elevated <on|off>",
|
||||
"/elev <on|off>",
|
||||
"/activation <mention|always>",
|
||||
"/deliver <on|off>",
|
||||
"/new or /reset",
|
||||
|
||||
Reference in New Issue
Block a user