From 88eb8a866b2266c83d9ded2e5a09d632ce592c40 Mon Sep 17 00:00:00 2001 From: Hamed Haghani Date: Tue, 27 May 2025 19:04:45 -0400 Subject: [PATCH] feat(utils): add parseCommands utility to format custom command configs --- src/utils/parseCommands.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/utils/parseCommands.ts diff --git a/src/utils/parseCommands.ts b/src/utils/parseCommands.ts new file mode 100644 index 0000000..c2a9740 --- /dev/null +++ b/src/utils/parseCommands.ts @@ -0,0 +1,18 @@ +type CommandEntry = { + key: string; + description: string; +}; + +type ParsedCommand = { + name: string; + key: string; + description: string; +}; + +export function parseCommands(commands: Record): ParsedCommand[] { + return Object.entries(commands).map(([name, details]) => ({ + name, + key: details.key, + description: details.description, + })); +}