forked from lzybkr/TabExpansionPlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall.ps1
51 lines (42 loc) · 1.55 KB
/
Install.ps1
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
48
49
50
param([string]$InstallDirectory)
$fileList = @(
'about_TabExpansion++.help.txt',
'Hyper-V.ArgumentCompleters.ps1',
'Microsoft.PowerShell.Core.ArgumentCompleters.ps1',
'Microsoft.PowerShell.Diagnostics.ArgumentCompleters.ps1',
'Microsoft.PowerShell.Management.ArgumentCompleters.ps1',
'Microsoft.PowerShell.Utility.ArgumentCompleters.ps1',
'NetAdapter.ArgumentCompleters.ps1',
'PrintManagement.ArgumentCompleters.ps1',
'ScheduledTasks.ArgumentCompleters.ps1',
'SmbShare.ArgumentCompleters.ps1',
'Storage.ArgumentCompleters.ps1',
'TabExpansion++.psd1',
'TabExpansion++.psm1',
'WindowsExe.ArgumentCompleters.ps1',
'WindowsExe.Messages.psd1',
'Snippets/ArgumentCompleterFunction.snippets.ps1xml'
)
if ('' -eq $InstallDirectory)
{
$personalModules = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath WindowsPowerShell\Modules
if (($env:PSModulePath -split ';') -notcontains $personalModules)
{
Write-Warning "$personalModules is not in `$env:PSModulePath"
}
if (!(Test-Path $personalModules))
{
Write-Error "$personalModules does not exist"
}
$InstallDirectory = Join-Path -Path $personalModules -ChildPath TabExpansion++
}
if (!(Test-Path $InstallDirectory))
{
$null = mkdir $InstallDirectory
$null = mkdir $InstallDirectory\Snippets
}
$wc = new-object System.Net.WebClient
$fileList | ForEach-Object {
$wc.DownloadFile("https://raw.github.com/lzybkr/TabExpansionPlusPlus/master/$_",
"$installDirectory\$_")
}