From 84b8cf43a175f9801abb6593c6b7fa2e39c05943 Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Mon, 16 Sep 2024 14:49:41 -0300 Subject: [PATCH] fix: rename delete command on undefined --- src/commands/renameCommand.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/commands/renameCommand.ts b/src/commands/renameCommand.ts index a4fc3bf..a9de1c2 100644 --- a/src/commands/renameCommand.ts +++ b/src/commands/renameCommand.ts @@ -9,6 +9,11 @@ const renameCommand = new Command('rename') .action((oldName: string, newName: string) => { const config = getConfig(); + if (!config.commands[oldName]) { + console.error('Command not found'); + process.exit(1); + } + config.commands[newName] = config.commands[oldName]; delete config.commands[oldName];