From e8a3ed1159d2a536ad7c23a692350880b664139a Mon Sep 17 00:00:00 2001 From: Mark Tiedemann Date: Thu, 24 Jan 2019 19:51:18 +0100 Subject: [PATCH] ps: Fix specifying version (#34) --- install.ps1 | 9 ++++----- install_test.ps1 | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/install.ps1 b/install.ps1 index dbc892c..c099224 100644 --- a/install.ps1 +++ b/install.ps1 @@ -2,13 +2,12 @@ # Copyright 2018 the Deno authors. All rights reserved. MIT license. # TODO(everyone): Keep this script simple and easily auditable. -param ( - [ValidatePattern('^v(\d+).(\d+).(\d+)$')] - [String] $Version -) - $ErrorActionPreference = 'Stop' +if ($args.Length -gt 0) { + $Version = $args.Get(0) +} + if ($PSVersionTable.PSVersion.Major -lt 6) { $IsWindows = $true $IsMacOS = $false diff --git a/install_test.ps1 b/install_test.ps1 index 520e345..053ba3c 100644 --- a/install_test.ps1 +++ b/install_test.ps1 @@ -10,7 +10,7 @@ if (!(Get-Module PSScriptAnalyzer -ListAvailable)) { Install-Module PSScriptAnalyzer -Scope CurrentUser -Force } -Invoke-ScriptAnalyzer *.ps1 -Exclude PSAvoidAssignmentToAutomaticVariable +Invoke-ScriptAnalyzer *.ps1 -EnableExit -Exclude PSAvoidAssignmentToAutomaticVariable if ($PSVersionTable.PSVersion.Major -lt 6) { $IsWindows = $true