Skip to content

Commit

Permalink
Refines worktree delete prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Sep 4, 2024
1 parent 35aaf9d commit cfc91d3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/commands/git/worktree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,11 @@ export class WorktreeGitCommand extends QuickCommand<State> {
const description =
state.uris.length === 1
? `delete worktree in $(folder) ${getWorkspaceFriendlyPath(state.uris[0])}`
: 'delete worktrees';
const branchesDescription = state.uris.length === 1 ? `and its branch` : 'and corresponding branches';
: `delete ${state.uris.length} worktrees`;
const descriptionWithBranchDelete =
state.uris.length === 1
? 'delete the worktree and then prompt to delete the associated branch'
: `delete ${state.uris.length} worktrees and then prompt to delete the associated branches`;

const step: QuickPickStep<FlagsQuickPickItem<DeleteFlags>> = createConfirmStep(
appendReposToTitle(`Confirm ${context.title}`, state, context),
Expand All @@ -983,14 +986,15 @@ export class WorktreeGitCommand extends QuickCommand<State> {
...(state.startingFromBranchDelete
? []
: [
createQuickPickSeparator<FlagsQuickPickItem<DeleteFlags>>(),
createFlagsQuickPickItem<DeleteFlags>(state.flags, ['--delete-branches'], {
label: `${label} & ${branchesLabel}`,
detail: `Will ${description} ${branchesDescription}`,
detail: `Will ${descriptionWithBranchDelete}`,
}),
createFlagsQuickPickItem<DeleteFlags>(state.flags, ['--force', '--delete-branches'], {
label: `Force ${label} & ${branchesLabel}`,
description: 'includes ANY UNCOMMITTED changes',
detail: `Will forcibly ${description} ${branchesDescription}`,
detail: `Will forcibly ${descriptionWithBranchDelete}`,
}),
]),
],
Expand Down

0 comments on commit cfc91d3

Please sign in to comment.