forked from di-sukharev/opencommit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
executable file
·32 lines (28 loc) · 886 Bytes
/
cli.ts
File metadata and controls
executable file
·32 lines (28 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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';
import { checkIsLatestVersion } from './utils/checkIsLatestVersion';
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 }
},
async () => {
await checkIsLatestVersion();
if (isHookCalled) {
prepareCommitMessageHook();
} else {
commit();
}
},
rawArgv
);