Browse Source

Adds commands for git command palette commands

main
Eric Amodio 3 years ago
parent
commit
31f00999ef
3 changed files with 127 additions and 2 deletions
  1. +76
    -0
      package.json
  2. +8
    -0
      src/commands/common.ts
  3. +43
    -2
      src/commands/gitCommands.ts

+ 76
- 0
package.json View File

@ -3351,6 +3351,46 @@
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.branch",
"title": "Git Branch...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.cherryPick",
"title": "Git Cherry Pick...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.merge",
"title": "Git Merge...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.rebase",
"title": "Git Rebase...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.reset",
"title": "Git Reset...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.revert",
"title": "Git Revert...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.switch",
"title": "Git Switch...",
"category": "GitLens"
},
{
"command": "gitlens.gitCommands.tag",
"title": "Git Tag...",
"category": "GitLens"
},
{
"command": "gitlens.switchMode",
"title": "Switch Mode",
"category": "GitLens"
@ -5283,6 +5323,42 @@
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.branch",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.cherryPick",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.merge",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.rebase",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.reset",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.revert",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.show",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.switch",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.gitCommands.tag",
"when": "!gitlens:disabled && !gitlens:readonly"
},
{
"command": "gitlens.switchMode",
"when": "gitlens:enabled"
},

+ 8
- 0
src/commands/common.ts View File

@ -102,6 +102,14 @@ export enum Commands {
PullRepositories = 'gitlens.pullRepositories',
PushRepositories = 'gitlens.pushRepositories',
GitCommands = 'gitlens.gitCommands',
GitCommandsBranch = 'gitlens.gitCommands.branch',
GitCommandsCherryPick = 'gitlens.gitCommands.cherryPick',
GitCommandsMerge = 'gitlens.gitCommands.merge',
GitCommandsRebase = 'gitlens.gitCommands.rebase',
GitCommandsReset = 'gitlens.gitCommands.reset',
GitCommandsRevert = 'gitlens.gitCommands.revert',
GitCommandsSwitch = 'gitlens.gitCommands.switch',
GitCommandsTag = 'gitlens.gitCommands.tag',
QuickOpenFileHistory = 'gitlens.quickOpenFileHistory',
RefreshHover = 'gitlens.refreshHover',
ResetAvatarCache = 'gitlens.resetAvatarCache',

+ 43
- 2
src/commands/gitCommands.ts View File

@ -1,6 +1,6 @@
'use strict';
import { Disposable, InputBox, QuickInputButton, QuickInputButtons, QuickPick, QuickPickItem, window } from 'vscode';
import { command, Command, Commands } from './common';
import { command, Command, CommandContext, Commands } from './common';
import { configuration, GitCommandSorting } from '../configuration';
import { Usage, WorkspaceState } from '../constants';
import { Container } from '../container';
@ -79,7 +79,48 @@ export class GitCommandsCommand extends Command {
private startedWith: 'menu' | 'command' = 'menu';
constructor() {
super(Commands.GitCommands);
super([
Commands.GitCommands,
Commands.GitCommandsBranch,
Commands.GitCommandsCherryPick,
Commands.GitCommandsMerge,
Commands.GitCommandsRebase,
Commands.GitCommandsReset,
Commands.GitCommandsRevert,
Commands.GitCommandsSwitch,
Commands.GitCommandsTag,
]);
}
protected preExecute(context: CommandContext, args?: GitCommandsCommandArgs) {
switch (context.command) {
case Commands.GitCommandsBranch:
args = { command: 'branch' };
break;
case Commands.GitCommandsCherryPick:
args = { command: 'cherry-pick' };
break;
case Commands.GitCommandsMerge:
args = { command: 'merge' };
break;
case Commands.GitCommandsRebase:
args = { command: 'rebase' };
break;
case Commands.GitCommandsReset:
args = { command: 'reset' };
break;
case Commands.GitCommandsRevert:
args = { command: 'revert' };
break;
case Commands.GitCommandsSwitch:
args = { command: 'switch' };
break;
case Commands.GitCommandsTag:
args = { command: 'tag' };
break;
}
return this.execute(args);
}
@log({ args: false, correlate: true, singleLine: true, timed: false })

Loading…
Cancel
Save