From 0e71bb917832b6fec287f9166ce8f3a2dc3210a3 Mon Sep 17 00:00:00 2001 From: Tomas Pilar Date: Thu, 31 Aug 2023 15:17:35 +0200 Subject: [PATCH] fix(config): new profile creation (#29) Signed-off-by: Tomas Pilar --- package.json | 2 +- src/middleware/profile.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index aac0d44..8d1e263 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ibm-generative-ai/cli", - "version": "1.3.1", + "version": "1.3.2", "description": "CLI for IBM Generative AI", "keywords": [ "ai", diff --git a/src/middleware/profile.js b/src/middleware/profile.js index 6b6628f..68e6108 100644 --- a/src/middleware/profile.js +++ b/src/middleware/profile.js @@ -3,8 +3,10 @@ import { allProfiles, loadProfileConfig } from "../utils/config.js"; // If profile has been selected, lazy load its configuration into yargs export function profileMiddleware(args) { if (!args.profile) return; - if (!allProfiles().includes(args.profile)) + if (!allProfiles().includes(args.profile)) { + if (args._.length === 1 && args._[0] === "config") return; // Only create config command can pass throw new Error("Profile not found"); + } Object.entries(loadProfileConfig(args.profile)).forEach(([key, value]) => { args[key] = value; });