Skip to content

Commit

Permalink
fix(config): new profile creation (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Pilar <tomas.pilar@ibm.com>
  • Loading branch information
pilartomas authored Aug 31, 2023
1 parent efece0d commit 0e71bb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/middleware/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit 0e71bb9

Please sign in to comment.