@@ -6,29 +6,57 @@ $Architecture = ""
66$InstallPath = ""
77$Help = $false
88
9+ # Debug: Show all arguments received
10+ Write-Host "[DEBUG] Script arguments received: $($args -join ' ')" -ForegroundColor Yellow
11+
912for ($i = 0; $i -lt $args.Length; $i++) {
1013 switch ($args[$i]) {
1114 "-Version" {
1215 if ($i + 1 -lt $args.Length) {
13- $Version = $args[++$i]
16+ $Version = $args[++$i]
17+ Write-Host "[DEBUG] Version parameter set to: '$Version'" -ForegroundColor Yellow
18+ } else {
19+ Write-Host "[WARN] -Version parameter provided but no value specified" -ForegroundColor Red
1420 }
1521 }
1622 "-Architecture" {
1723 if ($i + 1 -lt $args.Length) {
18- $Architecture = $args[++$i]
24+ $Architecture = $args[++$i]
25+ Write-Host "[DEBUG] Architecture parameter set to: '$Architecture'" -ForegroundColor Yellow
26+ } else {
27+ Write-Host "[WARN] -Architecture parameter provided but no value specified" -ForegroundColor Red
1928 }
2029 }
2130 "-InstallPath" {
2231 if ($i + 1 -lt $args.Length) {
23- $InstallPath = $args[++$i]
32+ $InstallPath = $args[++$i]
33+ Write-Host "[DEBUG] InstallPath parameter set to: '$InstallPath'" -ForegroundColor Yellow
34+ } else {
35+ Write-Host "[WARN] -InstallPath parameter provided but no value specified" -ForegroundColor Red
2436 }
2537 }
2638 "-Help" {
27- $Help = $true
39+ $Help = $true
40+ Write-Host "[DEBUG] Help parameter set" -ForegroundColor Yellow
41+ }
42+ default {
43+ # Handle cases where arguments might not have dashes
44+ if ($args[$i] -match "^v?\d+\.\d+\.\d+" -and -not $Version) {
45+ $Version = $args[$i]
46+ Write-Host "[DEBUG] Version detected from argument: '$Version'" -ForegroundColor Yellow
47+ }
2848 }
2949 }
3050}
3151
52+ # Additional debug info
53+ Write-Host "[DEBUG] Final parsed values:" -ForegroundColor Yellow
54+ Write-Host "[DEBUG] Version: '$Version'" -ForegroundColor Yellow
55+ Write-Host "[DEBUG] Architecture: '$Architecture'" -ForegroundColor Yellow
56+ Write-Host "[DEBUG] InstallPath: '$InstallPath'" -ForegroundColor Yellow
57+ Write-Host "[DEBUG] Help: $Help" -ForegroundColor Yellow
58+ Write-Host ""
59+
3260# Show help information
3361if ($Help) {
3462 Write-Host "AgbCloud CLI Installation Script"
@@ -87,14 +115,24 @@ Write-Host "[INFO] Installing AgbCloud CLI..."
87115Write-Host ""
88116
89117# Determine version with parameter priority
118+ Write-Host "[DEBUG] Determining version to install..." -ForegroundColor Yellow
119+ Write-Host "[DEBUG] Parsed Version parameter: '$Version'" -ForegroundColor Yellow
120+ Write-Host "[DEBUG] Environment AGBCLOUD_VERSION: '$($env:AGBCLOUD_VERSION)'" -ForegroundColor Yellow
121+
90122$version = if ($Version) {
123+ Write-Host "[DEBUG] Using Version parameter: '$Version'" -ForegroundColor Green
91124 $Version
92125} elseif ($env:AGBCLOUD_VERSION) {
126+ Write-Host "[DEBUG] Using environment variable AGBCLOUD_VERSION: '$($env:AGBCLOUD_VERSION)'" -ForegroundColor Green
93127 $env:AGBCLOUD_VERSION
94128} else {
129+ Write-Host "[DEBUG] No version specified, defaulting to 'latest'" -ForegroundColor Green
95130 "latest" # Default to latest version
96131}
97132
133+ Write-Host "[DEBUG] Final version decision: '$version'" -ForegroundColor Yellow
134+ Write-Host ""
135+
98136# Get latest version if needed
99137if ($version -eq "latest") {
100138 Write-Host "[INFO] Fetching latest version..."
0 commit comments