gitmoji-cli
Version:
A gitmoji client for using emojis on commit messages.
89 lines • 2.96 kB
JavaScript
from 'meow';
import updateNotifier from 'update-notifier';
import { readFileSync } from 'fs';
import FLAGS from "./constants/flags.js";
import findGitmojiCommand from "./utils/findGitmojiCommand.js";
const packageJson = readFileSync(new URL('../package.json', import.meta.url)).toString();
updateNotifier({
pkg: JSON.parse(packageJson)
}).notify({
isGlobal: true
});
const cli = meow(`
Usage
$ gitmoji [option] [command]
Options
--${FLAGS.COMMIT}, -c Interactively commit using the prompts
--${FLAGS.CONFIG}, -g Setup gitmoji-cli preferences.
--${FLAGS.INIT}, -i Initialize gitmoji as a commit hook
--${FLAGS.LIST}, -l List all the available gitmojis
--${FLAGS.REMOVE}, -r Remove a previously initialized commit hook
--${FLAGS.SEARCH}, -s Search gitmojis
--${FLAGS.UPDATE}, -u Sync emoji list with the repo
--${FLAGS.VERSION}, -v Print gitmoji-cli installed version
Commands
commit Interactively commit using the prompts
config Setup gitmoji-cli preferences.
init Initialize gitmoji as a commit hook
list List all the available gitmojis
remove Remove a previously initialized commit hook
search Search gitmojis
update Sync emoji list with the repo
Examples
$ gitmoji -l
$ gitmoji bug linter -s
`, {
importMeta: {
url: import.meta.url
},
flags: {
[ ]: {
type: 'boolean',
shortFlag: 'c'
},
[ ]: {
type: 'boolean',
shortFlag: 'g'
},
[ ]: {
type: 'boolean',
shortFlag: 'h'
},
[ ]: {
type: 'boolean',
shortFlag: 'i'
},
[ ]: {
type: 'boolean',
shortFlag: 'l'
},
[ ]: {
type: 'boolean',
shortFlag: 'r'
},
[ ]: {
type: 'boolean',
shortFlag: 's'
},
[ ]: {
type: 'boolean',
shortFlag: 'u'
},
[ ]: {
type: 'boolean',
shortFlag: 'v'
}
}
});
export const options = {
[ ]: async options => await (await import("./commands/commit/index.js")).default(options),
[ ]: async () => await (await import("./commands/config/index.js")).default(),
[ ]: async options => await (await import("./commands/commit/index.js")).default(options),
[ ]: async () => await (await import("./commands/hook/index.js")).default.create(),
[ ]: async () => await (await import("./commands/list/index.js")).default(),
[ ]: async () => await (await import("./commands/hook/index.js")).default.remove(),
[ ]: async options => await (await import("./commands/search/index.js")).default(options),
[ ]: async () => await (await import("./commands/update/index.js")).default()
};
findGitmojiCommand(cli, options);
import meow