From b67518ee7bea3cb49df181514c4184b41e0253dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Tu=C4=9Frul=20P=C4=B1nar?= Date: Mon, 29 Jan 2024 09:18:58 +0300 Subject: [PATCH] fix(help): build commands optinal params check if need one of them --- src/core/command-runner.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/command-runner.ts b/src/core/command-runner.ts index 8e2ae6b..c551f7b 100644 --- a/src/core/command-runner.ts +++ b/src/core/command-runner.ts @@ -137,6 +137,15 @@ export const runCommand = async (command: ProgramCommand) => { break; } case CommandTypes.BUILD: { + //Check optional params if need one of them + if(!params.branchId && !params.branch){ + console.error("error: You must provide either branchId or branch parameter"); + process.exit(1); + } + if(!params.workflowId && !params.workflow){ + console.error("error: You must provide either workflowId or workflow parameter"); + process.exit(1); + } const spinner = createOra(`Try to start a new build`).start(); try { responseData = await startBuild(params); @@ -277,8 +286,7 @@ export const runCommand = async (command: ProgramCommand) => { handleConfigCommand(command); break; default: { - console.log('Coomd: ', command.name(), command.args()) - console.error("Command not found"); + console.error("Command not found: ", commandName ); process.exit(1); } }