* 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:
di-sukharev
2023-03-11 00:19:29 +08:00
parent 91987030f0
commit c2ae98170c
+5 -1
View File
@@ -11,7 +11,9 @@ const config = getConfig();
let apiKey = config?.OPENAI_API_KEY;
if (!apiKey) {
const [command, mode] = process.argv.slice(2);
if (!apiKey && command !== 'config' && mode !== 'set') {
intro('opencommit');
outro(
@@ -20,6 +22,8 @@ if (!apiKey) {
outro(
'For help Look into README https://github.com/di-sukharev/opencommit#setup'
);
process.exit(1);
}
// if (!apiKey) {