-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathproviders.ts
More file actions
47 lines (44 loc) · 1.95 KB
/
providers.ts
File metadata and controls
47 lines (44 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { isWindows } from '../../../common/utils/platformUtils';
import { ShellConstants } from '../../common/shellConstants';
import { BashEnvsProvider } from './bash/bashEnvs';
import { BashStartupProvider, GitBashStartupProvider } from './bash/bashStartup';
import { CmdEnvsProvider } from './cmd/cmdEnvs';
import { CmdStartupProvider } from './cmd/cmdStartup';
import { FishEnvsProvider } from './fish/fishEnvs';
import { FishStartupProvider } from './fish/fishStartup';
import { PowerShellEnvsProvider } from './pwsh/pwshEnvs';
import { PwshStartupProvider } from './pwsh/pwshStartup';
import { ZshEnvsProvider } from './zsh/zshEnvs';
import { ZshStartupProvider } from './zsh/zshStartup';
import { ShellEnvsProvider, ShellStartupScriptProvider } from './startupProvider';
export function createShellStartupProviders(): ShellStartupScriptProvider[] {
if (isWindows()) {
return [
// PowerShell classic is the default on Windows, so it is included here explicitly.
// pwsh is the new PowerShell Core, which is cross-platform and preferred.
new PwshStartupProvider([ShellConstants.PWSH, 'powershell']),
new GitBashStartupProvider(),
new CmdStartupProvider(),
];
}
return [
new PwshStartupProvider([ShellConstants.PWSH]),
new BashStartupProvider(),
new FishStartupProvider(),
new ZshStartupProvider(),
];
}
export function createShellEnvProviders(): ShellEnvsProvider[] {
if (isWindows()) {
return [new PowerShellEnvsProvider(), new BashEnvsProvider(ShellConstants.GITBASH), new CmdEnvsProvider()];
}
return [
new PowerShellEnvsProvider(),
new BashEnvsProvider(ShellConstants.BASH),
new FishEnvsProvider(),
new ZshEnvsProvider(),
];
}
export async function clearShellProfileCache(providers: ShellStartupScriptProvider[]): Promise<void> {
await Promise.all(providers.map((provider) => provider.clearCache()));
}