From 94cd47f3c16d8a9b4fbef2ec2ef48abdaa92635d Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 13 Sep 2016 21:35:54 -0700 Subject: [PATCH] Add custom shell/args terminal example Fixes Microsoft/vscode#10917 --- terminal-example/README.md | 1 + terminal-example/package.json | 8 ++++++-- terminal-example/src/extension.ts | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/terminal-example/README.md b/terminal-example/README.md index 1d325c17..0b056249 100644 --- a/terminal-example/README.md +++ b/terminal-example/README.md @@ -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 diff --git a/terminal-example/package.json b/terminal-example/package.json index f81df6c4..12b44fea 100644 --- a/terminal-example/package.json +++ b/terminal-example/package.json @@ -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": { diff --git a/terminal-example/src/extension.ts b/terminal-example/src/extension.ts index 5e0f4b5e..04842713 100644 --- a/terminal-example/src/extension.ts +++ b/terminal-example/src/extension.ts @@ -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((vscode.window).createTerminal(`Ext Terminal #${terminalStack.length + 1}`, '/bin/zsh', ['-l'])); + })); function getLatestTerminal() { return terminalStack[terminalStack.length - 1];