Skip to content

Commit 59b6edb

Browse files
committed
format
1 parent 7683004 commit 59b6edb

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/commands/commit.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ ${chalk.grey('——————————————————')}`
138138
]);
139139

140140
pushSpinner.stop(
141-
`${chalk.green('✔')} Successfully pushed all commits to ${remotes[0]
141+
`${chalk.green('✔')} Successfully pushed all commits to ${
142+
remotes[0]
142143
}`
143144
);
144145

@@ -148,23 +149,26 @@ ${chalk.grey('——————————————————')}`
148149
process.exit(0);
149150
}
150151
} else {
151-
const skipOption = `don't push`
152+
const skipOption = `don't push`;
152153
const selectedRemote = (await select({
153154
message: 'Choose a remote to push to',
154-
options: [...remotes, skipOption].map((remote) => ({ value: remote, label: remote })),
155+
options: [...remotes, skipOption].map((remote) => ({
156+
value: remote,
157+
label: remote
158+
}))
155159
})) as string;
156160

157161
if (isCancel(selectedRemote)) process.exit(1);
158162

159163
if (selectedRemote !== skipOption) {
160164
const pushSpinner = spinner();
161-
165+
162166
pushSpinner.start(`Running 'git push ${selectedRemote}'`);
163-
167+
164168
const { stdout } = await execa('git', ['push', selectedRemote]);
165-
169+
166170
if (stdout) outro(stdout);
167-
171+
168172
pushSpinner.stop(
169173
`${chalk.green(
170174
'✔'
@@ -235,8 +239,9 @@ export async function commit(
235239

236240
stagedFilesSpinner.start('Counting staged files');
237241

238-
if (!stagedFiles.length) {
242+
if (stagedFiles.length === 0) {
239243
stagedFilesSpinner.stop('No files are staged');
244+
240245
const isStageAllAndCommitConfirmedByUser = await confirm({
241246
message: 'Do you want to stage all files and generate commit message?'
242247
});
@@ -245,7 +250,7 @@ export async function commit(
245250

246251
if (isStageAllAndCommitConfirmedByUser) {
247252
await commit(extraArgs, context, true, fullGitMojiSpec);
248-
process.exit(1);
253+
process.exit(0);
249254
}
250255

251256
if (stagedFiles.length === 0 && changedFiles.length > 0) {
@@ -257,13 +262,13 @@ export async function commit(
257262
}))
258263
})) as string[];
259264

260-
if (isCancel(files)) process.exit(1);
265+
if (isCancel(files)) process.exit(0);
261266

262267
await gitAdd({ files });
263268
}
264269

265270
await commit(extraArgs, context, false, fullGitMojiSpec);
266-
process.exit(1);
271+
process.exit(0);
267272
}
268273

269274
stagedFilesSpinner.stop(

src/utils/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const gitAdd = async ({ files }: { files: string[] }) => {
8080

8181
await execa('git', ['add', ...files]);
8282

83-
gitAddSpinner.stop('Done');
83+
gitAddSpinner.stop(`Done adding ${files.length} files`);
8484
};
8585

8686
export const getDiff = async ({ files }: { files: string[] }) => {

0 commit comments

Comments
 (0)