style(commit.ts): add question mark to confirm message
feat(commit.ts): add support for pushing to selected remote instead of default remote refactor(commit.ts): extract push command to a function and reuse it for both default and selected remote
This commit is contained in:
+13
-2
@@ -63,7 +63,7 @@ ${chalk.grey('——————————————————')}`
|
|||||||
);
|
);
|
||||||
|
|
||||||
const isCommitConfirmedByUser = await confirm({
|
const isCommitConfirmedByUser = await confirm({
|
||||||
message: 'Confirm the commit message'
|
message: 'Confirm the commit message?'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isCommitConfirmedByUser && !isCancel(isCommitConfirmedByUser)) {
|
if (isCommitConfirmedByUser && !isCancel(isCommitConfirmedByUser)) {
|
||||||
@@ -86,11 +86,19 @@ ${chalk.grey('——————————————————')}`
|
|||||||
|
|
||||||
if (isPushConfirmedByUser && !isCancel(isPushConfirmedByUser)) {
|
if (isPushConfirmedByUser && !isCancel(isPushConfirmedByUser)) {
|
||||||
const pushSpinner = spinner();
|
const pushSpinner = spinner();
|
||||||
|
|
||||||
pushSpinner.start(`Running \`git push ${remotes[0]}\``);
|
pushSpinner.start(`Running \`git push ${remotes[0]}\``);
|
||||||
const { stdout } = await execa('git', ['push', '--verbose', remotes[0]]);
|
|
||||||
|
const { stdout } = await execa('git', [
|
||||||
|
'push',
|
||||||
|
'--verbose',
|
||||||
|
remotes[0]
|
||||||
|
]);
|
||||||
|
|
||||||
pushSpinner.stop(
|
pushSpinner.stop(
|
||||||
`${chalk.green('✔')} successfully pushed all commits to ${remotes[0]}`
|
`${chalk.green('✔')} successfully pushed all commits to ${remotes[0]}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (stdout) outro(stdout);
|
if (stdout) outro(stdout);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -101,8 +109,11 @@ ${chalk.grey('——————————————————')}`
|
|||||||
|
|
||||||
if (!isCancel(selectedRemote)) {
|
if (!isCancel(selectedRemote)) {
|
||||||
const pushSpinner = spinner();
|
const pushSpinner = spinner();
|
||||||
|
|
||||||
pushSpinner.start(`Running \`git push ${selectedRemote}\``);
|
pushSpinner.start(`Running \`git push ${selectedRemote}\``);
|
||||||
|
|
||||||
const { stdout } = await execa('git', ['push', selectedRemote]);
|
const { stdout } = await execa('git', ['push', selectedRemote]);
|
||||||
|
|
||||||
pushSpinner.stop(
|
pushSpinner.stop(
|
||||||
`${chalk.green(
|
`${chalk.green(
|
||||||
'✔'
|
'✔'
|
||||||
|
|||||||
Reference in New Issue
Block a user