feat: config file at ~/.aicommits (#51)
Co-authored-by: Yu Le <is.yuler@gmail.com>
This commit is contained in:
10
src/cli.ts
10
src/cli.ts
@@ -3,11 +3,15 @@
|
||||
import { execSync } from 'child_process';
|
||||
import chalk from 'chalk';
|
||||
import inquirer from 'inquirer';
|
||||
import { generateCommitMessage } from './utils';
|
||||
|
||||
const OPENAI_KEY = process.env.OPENAI_KEY ?? process.env.OPENAI_API_KEY;
|
||||
import {
|
||||
getConfig,
|
||||
generateCommitMessage,
|
||||
} from './utils';
|
||||
|
||||
(async () => {
|
||||
const config = await getConfig();
|
||||
const OPENAI_KEY = process.env.OPENAI_KEY ?? process.env.OPENAI_API_KEY ?? config.OPENAI_KEY;
|
||||
|
||||
console.log(chalk.white('▲ ') + chalk.green('Welcome to AICommits!'));
|
||||
|
||||
if (!OPENAI_KEY) {
|
||||
|
||||
Reference in New Issue
Block a user