Skip to content

Commit

Permalink
Add custom shell/args terminal example
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Sep 14, 2016
1 parent b569310 commit 94cd47f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions terminal-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Several commands are exposed prefixed with "Terminal API" that show how to use t

- `Terminal API: Create Terminal`: Create a terminal
- `Terminal API: Create Terminal and Immediately Send`: Create a terminal and immediately send text
- `Terminal API: Create Terminal (zsh login shell)`: Create a zsh login shell terminal using a custom shell executable and arguments
- `Terminal API: Hide`: Hides the most recently created terminal
- `Terminal API: Show`: Shows the most recently created terminal
- `Terminal API: Send Text`: Sends `echo "Hello World!"` to the terminal
Expand Down
8 changes: 6 additions & 2 deletions terminal-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"version": "0.0.1",
"publisher": "Tyriar",
"engines": {
"vscode": "^1.0.0"
"vscode": "^1.5.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:terminalTest.createTerminal",
"onCommand:terminalTest.createAndSend"
"onCommand:terminalTest.createAndSend",
"onCommand:terminalTest.createZshLoginShell"
],
"main": "./out/src/extension",
"contributes": {
Expand Down Expand Up @@ -40,6 +41,9 @@
}, {
"command": "terminalTest.createAndSend",
"title": "Terminal API: Create Terminal and Immediately Send"
}, {
"command": "terminalTest.createZshLoginShell",
"title": "Terminal API: Create Terminal (zsh login shell) [v1.6+]"
}]
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions terminal-example/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export function activate(context: vscode.ExtensionContext) {
terminalStack.push(vscode.window.createTerminal(`Ext Terminal #${terminalStack.length + 1}`));
getLatestTerminal().sendText("echo 'Sent text immediately after creating'");
}));
context.subscriptions.push(vscode.commands.registerCommand('terminalTest.createZshLoginShell', () => {
terminalStack.push((<any>vscode.window).createTerminal(`Ext Terminal #${terminalStack.length + 1}`, '/bin/zsh', ['-l']));
}));

function getLatestTerminal() {
return terminalStack[terminalStack.length - 1];
Expand Down

0 comments on commit 94cd47f

Please sign in to comment.