d793bf1340
* feat: Add support for extra args to be passed to the git commit command
31 lines
790 B
JavaScript
Executable File
31 lines
790 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 extraArgs = 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(extraArgs);
|
|
}
|
|
},
|
|
extraArgs
|
|
);
|