Слияние кода завершено, страница обновится автоматически
Param([string]$InstallationDirectory = $($Env:USERPROFILE + "\.git-secrets"))
Write-Host "Checking to see if installation directory already exists..."
if (-not (Test-Path $InstallationDirectory))
{
Write-Host "Creating installation directory."
New-Item -ItemType Directory -Path $InstallationDirectory | Out-Null
}
else
{
Write-Host "Installation directory already exists."
}
Write-Host "Copying files."
Copy-Item ./git-secrets -Destination $InstallationDirectory -Force
Copy-Item ./git-secrets.1 -Destination $InstallationDirectory -Force
Write-Host "Checking if directory already exists in Path..."
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($currentPath -notlike "*$InstallationDirectory*")
{
Write-Host "Adding to path."
$newPath = $currentPath
if(-not ($newPath.EndsWith(";")))
{
$newPath = $newPath + ";"
}
$newPath = $newPath + $InstallationDirectory
[Environment]::SetEnvironmentVariable("PATH", $newPath, "User")
}
else
{
Write-Host "Already in Path."
}
# Adding to Session
Write-Host "Adding to user session."
$currentSessionPath = $Env:Path
if ($currentSessionPath -notlike "*$InstallationDirectory*")
{
if(-not ($currentSessionPath.EndsWith(";")))
{
$currentSessionPath = $currentSessionPath + ";"
}
$Env:Path = $currentSessionPath + $InstallationDirectory
}
Write-Host "Done."
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )