-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-setup.ps1
27 lines (22 loc) · 1.5 KB
/
dev-setup.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
Write-Output "Adding SimplePSLogger path to PSModulePath"
#Check If Path is already there
$SimplePSLoggerPath = Get-Location
$CurrentPaths = $env:PSModulePath.Split([IO.Path]::PathSeparator)
if ($CurrentPaths.Contains($SimplePSLoggerPath.Path.ToString())) {
Write-Output "SimplePSLogger path is already present in PowerShell module path. Yay!"
return
}
$SimplePSLoggerEnvPath = "$\env:PSModulePath += '$([IO.Path]::PathSeparator)$($SimplePSLoggerPath.Path)'"
$SimplePSLoggerPathcommandContent = "$([Environment]::NewLine)#Added by https://github.com/geekwhocodes/simple-ps-logger for local development $([Environment]::NewLine)"
$SimplePSLoggerPathcommandContent += $($SimplePSLoggerEnvPath.Replace('$\', '$'))
if (Test-Path $PROFILE.CurrentUserAllHosts) {
Write-Output "User(for all hosts) powershell profile found, adding SimplePSLogger path.r`
Read more about powershell profie here https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7"
}
else {
Write-Output "User(for all hosts) powershell profile not found, creating powershell profile for current user(for all hosts).r`
Read more about powershell profie here https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7"
New-Item -Type File -Force $PROFILE.CurrentUserAllHosts
}
Add-Content $PROFILE.CurrentUserAllHosts $SimplePSLoggerPathcommandContent
Write-Output "Added SimplePSLogger path to PSModulePath for local development."