Skip to content

Commit f2fb695

Browse files
committed
get-aspire-cli.ps1: switch to comment-based help; remove -Help switch and custom help handler
1 parent 4068463 commit f2fb695

File tree

1 file changed

+77
-56
lines changed

1 file changed

+77
-56
lines changed

eng/scripts/get-aspire-cli.ps1

Lines changed: 77 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
#!/usr/bin/env pwsh
22

3+
<#
4+
.SYNOPSIS
5+
Download and install the Aspire CLI
6+
7+
.DESCRIPTION
8+
Downloads and installs the Aspire CLI for the current platform from the specified version and quality.
9+
Automatically updates the current session's PATH environment variable and supports GitHub Actions.
10+
11+
Running with `-Quality release` downloads the latest release version of the Aspire CLI for your platform and architecture.
12+
Running with `-Quality staging` downloads the latest staging version, or the release version if no staging is available.
13+
Running with `-Quality dev` downloads the latest dev build from `main`.
14+
15+
The default quality is 'release'.
16+
17+
Pass a specific version to get CLI for that version.
18+
19+
.PARAMETER InstallPath
20+
Directory to install the CLI (default: %USERPROFILE%\.aspire\bin on Windows, `$HOME/.aspire/bin on Unix)
21+
22+
.PARAMETER Version
23+
Version of the Aspire CLI to download (default: unset)
24+
25+
.PARAMETER Quality
26+
Quality to download (default: release)
27+
28+
.PARAMETER OS
29+
Operating system (default: auto-detect)
30+
31+
.PARAMETER Architecture
32+
Architecture (default: auto-detect)
33+
34+
.PARAMETER KeepArchive
35+
Keep downloaded archive files and temporary directory after installation
36+
37+
.EXAMPLE
38+
.\get-aspire-cli.ps1
39+
40+
.EXAMPLE
41+
.\get-aspire-cli.ps1 -InstallPath "C:\\tools\\aspire"
42+
43+
.EXAMPLE
44+
.\get-aspire-cli.ps1 -Quality "staging"
45+
46+
.EXAMPLE
47+
.\get-aspire-cli.ps1 -Version "9.5.0-preview.1.25366.3"
48+
49+
.EXAMPLE
50+
.\get-aspire-cli.ps1 -OS "linux" -Architecture "x64"
51+
52+
.EXAMPLE
53+
.\get-aspire-cli.ps1 -KeepArchive
54+
55+
.EXAMPLE
56+
.\get-aspire-cli.ps1 -WhatIf
57+
58+
.EXAMPLE
59+
# Piped execution
60+
iex "& { $(irm https://aka.ms/aspire/get/install.ps1) }"
61+
62+
.EXAMPLE
63+
# Piped execution
64+
iex "& { $(irm https://aka.ms/aspire/get/install.ps1) } -Quality staging"
65+
66+
.NOTES
67+
The script automatically updates the PATH environment variable for the current session.
68+
69+
Windows: The script will also add the installation path to the user's persistent PATH
70+
environment variable and to the session PATH, making the aspire CLI available in the existing and new terminal sessions.
71+
72+
GitHub Actions Support:
73+
When running in GitHub Actions (GITHUB_ACTIONS=true), the script will automatically
74+
append the installation path to the GITHUB_PATH file to make the CLI available in
75+
subsequent workflow steps.
76+
#>
77+
378
[CmdletBinding(SupportsShouldProcess)]
479
param(
580
[Parameter(HelpMessage = "Directory to install the CLI")]
@@ -21,10 +96,7 @@ param(
2196
[string]$Architecture = "",
2297

2398
[Parameter(HelpMessage = "Keep downloaded archive files and temporary directory after installation")]
24-
[switch]$KeepArchive,
25-
26-
[Parameter(HelpMessage = "Show help message")]
27-
[switch]$Help
99+
[switch]$KeepArchive
28100
)
29101

30102
# Global constants
@@ -108,58 +180,7 @@ function Write-Message {
108180
}
109181
}
110182

111-
if ($Help) {
112-
Write-Message @"
113-
Aspire CLI Download Script
114-
115-
DESCRIPTION:
116-
Downloads and installs the Aspire CLI for the current platform from the specified version and quality.
117-
Automatically updates the current session's PATH environment variable and supports GitHub Actions.
118-
119-
Running with `-Quality release` download the latest release version of the Aspire CLI for your platform and architecture.
120-
Running with `-Quality staging` will download the latest staging version, or the release version if no staging is available.
121-
Running with `-Quality dev` will download the latest dev build from `main`.
122-
123-
The default quality is '$($Script:Config.DefaultQuality)'.
124-
125-
Pass a specific version to get CLI for that version.
126-
127-
PARAMETERS:
128-
-InstallPath <string> Directory to install the CLI (default: %USERPROFILE%\.aspire\bin on Windows, `$HOME/.aspire/bin on Unix)
129-
-Quality <string> Quality to download (default: $($Script:Config.DefaultQuality))
130-
-Version <string> Version of the Aspire CLI to download (default: unset)
131-
-OS <string> Operating system (default: auto-detect)
132-
-Architecture <string> Architecture (default: auto-detect)
133-
-KeepArchive Keep downloaded archive files and temporary directory after installation
134-
-Help Show this help message
135-
136-
ENVIRONMENT:
137-
The script automatically updates the PATH environment variable for the current session.
138-
139-
Windows: The script will also add the installation path to the user's persistent PATH
140-
environment variable and to the session PATH, making the aspire CLI available in the existing and new terminal sessions.
141-
142-
GitHub Actions Support:
143-
When running in GitHub Actions (GITHUB_ACTIONS=true), the script will automatically
144-
append the installation path to the GITHUB_PATH file to make the CLI available in
145-
subsequent workflow steps.
146-
147-
EXAMPLES:
148-
.\get-aspire-cli.ps1
149-
.\get-aspire-cli.ps1 -InstallPath "C:\tools\aspire"
150-
.\get-aspire-cli.ps1 -Quality "staging"
151-
.\get-aspire-cli.ps1 -Version "9.5.0-preview.1.25366.3"
152-
.\get-aspire-cli.ps1 -OS "linux" -Architecture "x64"
153-
.\get-aspire-cli.ps1 -KeepArchive
154-
.\get-aspire-cli.ps1 -WhatIf
155-
.\get-aspire-cli.ps1 -Help
156-
157-
# Piped execution
158-
iex "& { `$(irm https://aka.ms/aspire/get/install.ps1) }"
159-
iex "& { `$(irm https://aka.ms/aspire/get/install.ps1) } -Quality staging"
160-
"@
161-
if ($InvokedFromFile) { exit 0 } else { return }
162-
}
183+
## Help is provided via the comment-based help block above; use Get-Help to view.
163184

164185
# Helper function for PowerShell version-specific operations
165186
function Invoke-WithPowerShellVersion {

0 commit comments

Comments
 (0)