forked from dotnet/docfx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.ps1
More file actions
38 lines (35 loc) · 752 Bytes
/
common.ps1
File metadata and controls
38 lines (35 loc) · 752 Bytes
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
function GetOperatingSystemName()
{
if ([environment]::OSVersion.Platform -eq "Win32NT") {
return "Windows"
}
else {
return "Linux"
}
}
function GetNuGetCommand([string]$os)
{
if ($os -eq "Windows") {
return "$env:LOCALAPPDATA/Nuget/Nuget.exe"
}
else {
return "nuget"
}
}
function ProcessLastExitCode {
param($exitCode, $msg)
if ($exitCode -eq 0) {
Write-Host "Success: $msg
" -ForegroundColor Green
}
else {
Write-Host "Error $($exitCode): $msg
" -ForegroundColor Red
Pop-Location
Exit 1
}
}
function ValidateCommand {
param($command)
return (Get-Command $command -ErrorAction SilentlyContinue) -ne $null
}