Skip to content

Commit

Permalink
fix_ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
epompeii committed Nov 29, 2024
1 parent 54d462b commit b4d5b17
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions services/cli/templates/install-cli.ps1.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ If you get an error that says "running scripts is disabled on this system":
- Enter: `Y`
- Rerun this script

.PARAMETER AppVersion
The version of the application to install

.PARAMETER ArtifactDownloadUrl
The URL of the directory where artifacts can be fetched from

Expand All @@ -31,18 +34,18 @@ Print help

#>

$app_name = 'bencher'
$app_version = if ($env:BENCHER_VERSION) { $env:BENCHER_VERSION } else { '{{ app_version }}' }

param (
[Parameter(HelpMessage = "The URL of the directory where artifacts can be fetched from")]
[string]$ArtifactDownloadUrl = "https://bencher.dev/download/$app_version",
[Parameter(HelpMessage = "Don't add the install directory to PATH")]
[switch]$NoModifyPath,
[Parameter(HelpMessage = "Print Help")]
[switch]$Help
[Parameter(HelpMessage = "The version of the application to install")]
[string]$AppVersion = $env:BENCHER_VERSION -or '{{ app_version }}'
[Parameter(HelpMessage = "The URL of the directory where artifacts can be fetched from")]
[string]$ArtifactDownloadUrl = $(if ($env:BENCHER_VERSION) { "https://bencher.dev/download/$env:BENCHER_VERSION" } else { "https://bencher.dev/download/{{ app_version }}" }),
[Parameter(HelpMessage = "Don't add the install directory to PATH")]
[switch]$NoModifyPath,
[Parameter(HelpMessage = "Print Help")]
[switch]$Help
)

$app_name = 'bencher'

function Install-Binary($install_args) {
if ($Help) {
Expand All @@ -55,7 +58,7 @@ function Install-Binary($install_args) {
$platforms = @{
{%- for artifact in artifacts %}
"{{ artifact.target_triple }}" = @{
"artifact_name" = "$app_name-v$app_version-{{ artifact.os_arch }}.exe"
"artifact_name" = "$app_name-v$AppVersion-{{ artifact.os_arch }}.exe"
"zip_ext" = "{{ artifact.zip_style }}"
"bins" = {% for bin in artifact.binaries -%}
"{{ bin }}"{{ ", " if not loop.last else "" }}
Expand Down Expand Up @@ -137,7 +140,7 @@ https://github.com/bencherdev/bencher/issues

# Download and unpack!
$url = "$download_url/$artifact_name"
Write-Information "Downloading Bencher CLI ($app_name $app_version)"
Write-Information "Downloading Bencher CLI ($app_name $AppVersion)"
Write-Verbose " From: $url"
Write-Verbose " To: $dir_path"
$wc = New-Object Net.Webclient
Expand Down

0 comments on commit b4d5b17

Please sign in to comment.