@buildo/hophop
Version:
A minimal tool to accelerate the GitHub workflow from the command line.
25 lines (20 loc) • 942 B
JavaScript
import R from 'ramda';
import { checkForUpdates, parseArgs } from './utils';
import { gh_commit, gh_feature, gh_pr, gh_setup } from './gh';
import { toggl_start, toggl_stop, toggl_install_hooks, toggl_setup } from './toggl';
const commands = [
[R.whereEq({ cmd: 'gh', cmd_gh: 'setup' }), gh_setup],
[R.whereEq({ cmd: 'gh', cmd_gh: 'feature' }), gh_feature],
[R.whereEq({ cmd: 'gh', cmd_gh: 'pr' }), gh_pr],
[R.whereEq({ cmd: 'gh', cmd_gh: 'commit' }), gh_commit],
[R.whereEq({ cmd: 'toggl', cmd_toggl: 'setup' }), toggl_setup],
[R.whereEq({ cmd: 'toggl', cmd_toggl: 'start' }), toggl_start],
[R.whereEq({ cmd: 'toggl', cmd_toggl: 'stop' }), toggl_stop],
[R.whereEq({ cmd: 'toggl', cmd_toggl: 'install-hooks' }), toggl_install_hooks]
];
async function main() {
checkForUpdates();
const args = parseArgs();
R.find((x) => x[0](args))(commands)[1](args).then(() => process.exit(0)).catch((x) => { throw x; });
}
main();