Skip to content

Commit 4b132e0

Browse files
committed
Adds open in terminal command to repos
1 parent a822544 commit 4b132e0

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
99
### Added
1010

1111
- Adds pinning of comparisons in the _Compare_ view — pinned comparisons will persist across reloads
12+
- Adds an _Open in Terminal_ command to repositories in the _Repositories_ view
1213

1314
### Fixed
1415

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,11 @@
22472247
"light": "images/light/icon-push-force.svg"
22482248
}
22492249
},
2250+
{
2251+
"command": "gitlens.views.openInTerminal",
2252+
"title": "Open in Terminal",
2253+
"category": "GitLens"
2254+
},
22502255
{
22512256
"command": "gitlens.views.setAsDefault",
22522257
"title": "Set as Default",
@@ -3083,6 +3088,10 @@
30833088
"command": "gitlens.views.pushWithForce",
30843089
"when": "false"
30853090
},
3091+
{
3092+
"command": "gitlens.views.openInTerminal",
3093+
"when": "false"
3094+
},
30863095
{
30873096
"command": "gitlens.views.setAsDefault",
30883097
"when": "false"
@@ -4332,6 +4341,10 @@
43324341
"group": "1_gitlens@2"
43334342
},
43344343
{
4344+
"command": "gitlens.views.openInTerminal",
4345+
"when": "viewItem =~ /gitlens:repository\\b/",
4346+
"group": "2_gitlens@1"
4347+
},
43354348
{
43364349
"command": "gitlens.openRepoInRemote",
43374350
"when": "viewItem =~ /gitlens:repository\\b/ && gitlens:hasRemotes",

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export enum BuiltInCommands {
1818
FocusFilesExplorer = 'workbench.files.action.focusFilesExplorer',
1919
Open = 'vscode.open',
2020
OpenFolder = 'vscode.openFolder',
21+
OpenInTerminal = 'openInTerminal',
2122
NextEditor = 'workbench.action.nextEditor',
2223
PreviewHtml = 'vscode.previewHtml',
2324
RevealLine = 'revealLine',

src/views/viewCommands.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export class ViewCommands implements Disposable {
7777
commands.registerCommand('gitlens.views.setAsDefault', this.setAsDefault, this);
7878
commands.registerCommand('gitlens.views.unsetAsDefault', this.unsetAsDefault, this);
7979

80+
commands.registerCommand('gitlens.views.openInTerminal', this.openInTerminal, this);
8081
commands.registerCommand('gitlens.views.star', this.star, this);
8182
commands.registerCommand('gitlens.views.unstar', this.unstar, this);
8283

@@ -457,6 +458,12 @@ export class ViewCommands implements Disposable {
457458
} as OpenFileInRemoteCommandArgs);
458459
}
459460

461+
private openInTerminal(node: RepositoryNode) {
462+
if (!(node instanceof RepositoryNode)) return;
463+
464+
return commands.executeCommand(BuiltInCommands.OpenInTerminal, Uri.file(node.repo.path));
465+
}
466+
460467
private setAsDefault(node: RemoteNode) {
461468
if (node instanceof RemoteNode) return node.setAsDefault();
462469
return;

0 commit comments

Comments
 (0)