diff --git a/src/commands/git/merge.ts b/src/commands/git/merge.ts index 8ad1ccb..56d8956 100644 --- a/src/commands/git/merge.ts +++ b/src/commands/git/merge.ts @@ -145,15 +145,14 @@ export class MergeGitCommand extends QuickCommandBase { const step = this.createConfirmStep( `Confirm ${this.title}${Strings.pad(GlyphChars.Dot, 2, 2)}${state.repo.formattedName}`, [], - { - cancel: DirectiveQuickPickItem.create(Directive.Cancel, true, { - label: `Cancel ${this.title}`, - detail: `${destination.name} is up to date with ${state.reference.name}` - }) - } - ); + DirectiveQuickPickItem.create(Directive.Cancel, true, { + label: `Cancel ${this.title}`, + detail: `${destination.name} is up to date with ${state.reference.name}` + }) + ); yield step; + break; } diff --git a/src/commands/git/pull.ts b/src/commands/git/pull.ts index a1eac4f..6e36cde 100644 --- a/src/commands/git/pull.ts +++ b/src/commands/git/pull.ts @@ -170,40 +170,45 @@ export class PullGitCommand extends QuickCommandBase { ).fromNow()}`; } - const step = this.createConfirmStep(`${title}${fetchedOn}`, [ - { - label: this.title, - description: '', - detail: `Will pull ${detail}`, - item: [] - }, + const step = this.createConfirmStep( + `${title}${fetchedOn}`, + [ + { + label: this.title, + description: '', + detail: `Will pull ${detail}`, + item: [] + }, + { + label: `${this.title} with Rebase`, + description: '--rebase', + detail: `Will pull ${detail} with rebase`, + item: ['--rebase'] + } + ], + undefined, { - label: `${this.title} with Rebase`, - description: '--rebase', - detail: `Will pull ${detail} with rebase`, - item: ['--rebase'] - } - ]); - - step.additionalButtons = [this.Buttons.Fetch]; - step.onDidClickButton = async (quickpick, button) => { - if (button !== this.Buttons.Fetch) return; - - quickpick.title = `${title}${Strings.pad(GlyphChars.Dot, 2, 2)}Fetching${GlyphChars.Ellipsis}`; - quickpick.busy = true; - quickpick.enabled = false; - - try { - await repo.fetch({ progress: true }); - - const step = await this.getSingleRepoConfirmStep(state); - quickpick.title = step.title; - quickpick.items = step.items as any; - } finally { - quickpick.busy = false; - quickpick.enabled = true; + additionalButtons: [this.Buttons.Fetch], + onDidClickButton: async (quickpick, button) => { + if (button !== this.Buttons.Fetch) return; + + quickpick.title = `${title}${Strings.pad(GlyphChars.Dot, 2, 2)}Fetching${GlyphChars.Ellipsis}`; + quickpick.busy = true; + quickpick.enabled = false; + + try { + await repo.fetch({ progress: true }); + + const step = await this.getSingleRepoConfirmStep(state); + quickpick.title = step.title; + quickpick.items = step.items as any; + } finally { + quickpick.busy = false; + quickpick.enabled = true; + } + } } - }; + ); return step; } diff --git a/src/commands/git/push.ts b/src/commands/git/push.ts index 4b61263..0ad47f3 100644 --- a/src/commands/git/push.ts +++ b/src/commands/git/push.ts @@ -153,12 +153,10 @@ export class PushGitCommand extends QuickCommandBase { return this.createConfirmStep( `Confirm ${this.title}${Strings.pad(GlyphChars.Dot, 2, 2)}${repo.formattedName}`, [], - { - cancel: DirectiveQuickPickItem.create(Directive.Cancel, true, { - label: `Cancel ${this.title}`, - detail: 'No commits to push' - }) - } + DirectiveQuickPickItem.create(Directive.Cancel, true, { + label: `Cancel ${this.title}`, + detail: 'No commits to push' + }) ); } diff --git a/src/commands/git/rebase.ts b/src/commands/git/rebase.ts index fa851d8..9d87eb5 100644 --- a/src/commands/git/rebase.ts +++ b/src/commands/git/rebase.ts @@ -228,15 +228,13 @@ export class RebaseGitCommand extends QuickCommandBase { const step = this.createConfirmStep( `Confirm ${this.title}${Strings.pad(GlyphChars.Dot, 2, 2)}${state.repo.formattedName}`, [], - { - cancel: DirectiveQuickPickItem.create(Directive.Cancel, true, { - label: `Cancel ${this.title}`, - detail: `${destination.name} is up to date with ${state.reference.name}` - }) - } + DirectiveQuickPickItem.create(Directive.Cancel, true, { + label: `Cancel ${this.title}`, + detail: `${destination.name} is up to date with ${state.reference.name}` + }) ); - yield step; + break; } diff --git a/src/commands/git/stash.ts b/src/commands/git/stash.ts index fe93da2..3204d6a 100644 --- a/src/commands/git/stash.ts +++ b/src/commands/git/stash.ts @@ -381,6 +381,7 @@ export class StashGitCommand extends QuickCommandBase { item: [] } ], + undefined, { placeholder: `Confirm ${this.title} ${getSubtitle(state.subcommand)}` } ); const selection: StepSelection = yield step; @@ -442,7 +443,6 @@ export class StashGitCommand extends QuickCommandBase { state.stash = selection[0].item; } - // if (this.confirm(state.confirm)) { const message = state.stash.message.length > 80 ? `${state.stash.message.substring(0, 80)}${GlyphChars.Ellipsis}` @@ -459,6 +459,7 @@ export class StashGitCommand extends QuickCommandBase { detail: `Will delete ${state.stash.stashName}` } ], + undefined, { placeholder: `Confirm ${this.title} ${getSubtitle(state.subcommand)}` } ); const selection: StepSelection = yield step; @@ -611,6 +612,7 @@ export class StashGitCommand extends QuickCommandBase { item: ['--keep-index'] } ], + undefined, { placeholder: `Confirm ${this.title} ${getSubtitle(state.subcommand)}` } ); const selection: StepSelection = yield step; diff --git a/src/commands/quickCommand.ts b/src/commands/quickCommand.ts index 103382b..a1151b3 100644 --- a/src/commands/quickCommand.ts +++ b/src/commands/quickCommand.ts @@ -156,19 +156,15 @@ export abstract class QuickCommandBase implements QuickPickItem { protected createConfirmStep( title: string, confirmations: T[], - { - cancel, - placeholder - }: { - cancel?: DirectiveQuickPickItem; - placeholder?: string; - } = {} + cancel?: DirectiveQuickPickItem, + options: Partial> = {} ): QuickPickStep { return this.createPickStep({ - placeholder: placeholder || `Confirm ${this.title}`, + placeholder: `Confirm ${this.title}`, title: title, items: [...confirmations, cancel || DirectiveQuickPickItem.create(Directive.Cancel)], - selectedItems: [confirmations[0]] + selectedItems: [confirmations[0]], + ...options }); }