git-lite-cli
Version:
A lightweight CLI tool for seamless GitHub automation—create, initialize, and push repositories with a single command.
33 lines • 959 B
JavaScript
import { confirm, select, text } from '@clack/prompts';
import { handleCancel } from '../utils/promptHandler.js';
export default async function branch(branches) {
const isNewBranch = await confirm({
message: 'do you want to create a new branch?',
});
handleCancel(isNewBranch);
if (isNewBranch) {
const newBranch = await text({
message: 'Enter the name of the new branch:',
});
handleCancel(newBranch);
return {
branch: newBranch,
isNewBranch: isNewBranch,
};
}
const branch = await select({
message: 'Which branch do you want to switch to?',
options: [
...branches.map((branch) => ({
value: branch,
label: branch,
})),
],
});
handleCancel(branch);
return {
branch: branch,
isNewBranch: isNewBranch,
};
}
//# sourceMappingURL=branch.js.map