b35a393152
* docs(api.ts): update error message to remind user to add payment details to OpenAI API key * refactor(cli.ts): remove unused import * refactor(config.ts): update error message to use outro instead of throwing an error and exit the process * chore(generateCommitMessageFromGitDiff.ts): add console.log for error debugging
31 lines
777 B
JavaScript
Executable File
31 lines
777 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { cli } from 'cleye';
|
|
import packageJSON from '../package.json' assert { type: 'json' };
|
|
|
|
import { configCommand } from './commands/config';
|
|
import { hookCommand, isHookCalled } from './commands/githook.js';
|
|
import { prepareCommitMessageHook } from './commands/prepare-commit-msg-hook';
|
|
import { commit } from './commands/commit';
|
|
|
|
const rawArgv = process.argv.slice(2);
|
|
|
|
cli(
|
|
{
|
|
version: packageJSON.version,
|
|
name: 'opencommit',
|
|
commands: [configCommand, hookCommand],
|
|
flags: {},
|
|
ignoreArgv: (type) => type === 'unknown-flag' || type === 'argument',
|
|
help: { description: packageJSON.description }
|
|
},
|
|
() => {
|
|
if (isHookCalled) {
|
|
prepareCommitMessageHook();
|
|
} else {
|
|
commit();
|
|
}
|
|
},
|
|
rawArgv
|
|
);
|