Skip to content

Commit

Permalink
shell-integration -> locate-shell-integration-path
Browse files Browse the repository at this point in the history
Part of #153921
  • Loading branch information
Tyriar committed Jul 19, 2022
1 parent 13d630d commit ee63628
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/vs/code/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ export async function main(argv: string[]): Promise<any> {
}

// Shell integration
else if (args['shell-integration']) {
else if (args['locate-shell-integration-path']) {
// Silently fail when the terminal is not VS Code's integrated terminal
if (process.env['TERM_PROGRAM'] !== 'vscode') {
return;
}
let file: string;
switch (args['shell-integration']) {
// Usage: `[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --shell-integration bash)"`
switch (args['locate-shell-integration-path']) {
// Usage: `[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path bash)"`
case 'bash': file = 'shellIntegration-bash.sh'; break;
// Usage: `if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --shell-integration pwsh)" }`
// Usage: `if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }`
case 'pwsh': file = 'shellIntegration.ps1'; break;
// Usage: `[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --shell-integration zsh)"`
// Usage: `[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"`
case 'zsh': file = 'shellIntegration-rc.zsh'; break;
default: throw new Error('Error using --shell-integration: Invalid shell type');
default: throw new Error('Error using --locate-shell-integration-path: Invalid shell type');
}
console.log(join(dirname(FileAccess.asFileUri('', require)).fsPath, 'out', 'vs', 'workbench', 'contrib', 'terminal', 'browser', 'media', file));
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/environment/common/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface NativeParsedArgs {
'logsPath'?: string;
'__enable-file-policy'?: boolean;
editSessionId?: string;
'shell-integration'?: string;
'locate-shell-integration-path'?: string;

// chromium command line args: https://electronjs.org/docs/all#supported-chrome-command-line-switches
'no-proxy-server'?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/environment/node/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'logsPath': { type: 'string' },
'__enable-file-policy': { type: 'boolean' },
'editSessionId': { type: 'string' },
'shell-integration': { type: 'string', args: ['bash', 'pwsh', 'zsh'] },
'locate-shell-integration-path': { type: 'string', args: ['bash', 'pwsh', 'zsh'] },

// chromium flags
'no-proxy-server': { type: 'boolean' },
Expand Down
2 changes: 1 addition & 1 deletion src/vs/server/node/server.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const isSupportedForCmd = (optionId: keyof RemoteParsedArgs) => {
case 'enable-smoke-test-driver':
case 'extensions-download-dir':
case 'builtin-extensions-dir':
case 'shell-integration':
case 'locate-shell-integration-path':
case 'telemetry':
return false;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/vs/server/node/serverEnvironmentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const serverOptions: OptionDescriptions<ServerParsedArgs> = {

'help': OPTIONS['help'],
'version': OPTIONS['version'],
'shell-integration': OPTIONS['shell-integration'],
'locate-shell-integration-path': OPTIONS['locate-shell-integration-path'],

'compatibility': { type: 'string' },

Expand Down Expand Up @@ -194,7 +194,7 @@ export interface ServerParsedArgs {
/* ----- server cli ----- */
help: boolean;
version: boolean;
'shell-integration'?: string;
'locate-shell-integration-path'?: string;

compatibility: string;

Expand Down

0 comments on commit ee63628

Please sign in to comment.