77# irm https://catswords.blob.core.windows.net/welsonjs/bootstrap.ps1 | iex
88# irm https://catswords.blob.core.windows.net/welsonjs/bootstrap.ps1 | iex -dev main
99# irm https://catswords.blob.core.windows.net/welsonjs/bootstrap.ps1 | iex -dev dev
10+ # irm https://catswords.blob.core.windows.net/welsonjs/bootstrap.ps1 | iex main
1011#
1112# Central default branch configuration for this install script.
1213# Update this value if the repository's default branch changes.
13- $DefaultBranch = " master"
14-
15- param (
16- # Branch to install from; defaults to the repository's configured primary branch.
17- [string ]$dev = $DefaultBranch
18- )
14+ $defaultBranch = " master"
1915
2016$ErrorActionPreference = " Stop"
2117
@@ -32,6 +28,27 @@ function Write-Err($msg) {
3228}
3329
3430try {
31+ # Step 0: Parse arguments (iex-compatible)
32+ # Supports:
33+ # iex -dev main
34+ # iex main
35+ # iex
36+ $branch = $defaultBranch
37+
38+ for ($i = 0 ; $i -lt $args.Count ; $i ++ ) {
39+ $arg = $args [$i ]
40+
41+ if ($arg -eq " -dev" -and ($i + 1 ) -lt $args.Count ) {
42+ $branch = $args [$i + 1 ]
43+ break
44+ }
45+ elseif ($arg -notmatch " ^-" ) {
46+ $branch = $arg
47+ }
48+ }
49+
50+ Write-Step " Using branch: $branch "
51+
3552 # Step 1: Create a temporary working directory using a UUID
3653 Write-Step " Creating temporary workspace..."
3754
4562 $repo = " gnh1201/welsonjs"
4663 $zipPath = Join-Path $tempDir " package.zip"
4764
48- # Step 2: Determine branch (default: master)
49- $branch = $dev
50-
51- Write-Step " Using branch: $branch "
52-
53- # GitHub branch ZIP URL
65+ # Step 2: Build download URL
5466 $downloadUrl = " https://github.com/$repo /archive/refs/heads/$branch .zip"
5567
5668 Write-Ok " Download URL: $downloadUrl "
@@ -102,4 +114,4 @@ try {
102114catch {
103115 Write-Err $_
104116 exit 1
105- }
117+ }
0 commit comments