* refactor(api.ts): move apiKey initialization to the top of the file
* feat(api.ts): add check for process arguments to avoid intro message if 'config set' command is used
This commit is contained in:
+5
-1
@@ -11,7 +11,9 @@ const config = getConfig();
|
|||||||
|
|
||||||
let apiKey = config?.OPENAI_API_KEY;
|
let apiKey = config?.OPENAI_API_KEY;
|
||||||
|
|
||||||
if (!apiKey) {
|
const [command, mode] = process.argv.slice(2);
|
||||||
|
|
||||||
|
if (!apiKey && command !== 'config' && mode !== 'set') {
|
||||||
intro('opencommit');
|
intro('opencommit');
|
||||||
|
|
||||||
outro(
|
outro(
|
||||||
@@ -20,6 +22,8 @@ if (!apiKey) {
|
|||||||
outro(
|
outro(
|
||||||
'For help Look into README https://github.com/di-sukharev/opencommit#setup'
|
'For help Look into README https://github.com/di-sukharev/opencommit#setup'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!apiKey) {
|
// if (!apiKey) {
|
||||||
|
|||||||
Reference in New Issue
Block a user