Add custom shell/args terminal example

Fixes Microsoft/vscode#10917
This commit is contained in:
Daniel Imms
2016-09-13 21:35:54 -07:00
parent b569310d7d
commit 94cd47f3c1
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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": {
@ -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": {

View File

@ -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];