merge-drivers
Version:
Merge Drivers CLI: A command-line interface to conveniently manage custom git merge drivers
24 lines (18 loc) • 495 B
JavaScript
import ora from 'ora';
/**
* Executes an async function using ora to display a spinner.
*
* @param {string} title - Title used to describe the action.
* @param {() => Promise<unknown | void>} asyncFunction - Async function to be executed.
*/
export async function action(title, asyncFunction) {
const spinner = ora(title).start();
try {
await asyncFunction();
spinner.succeed(title);
} catch (error) {
spinner.fail(title);
return error;
}
return undefined;
}