File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ param (
2+ [string ]$Version
3+ )
4+
5+ if (-not $Version ) {
6+ Write-Host " 🔍 No version provided, fetching latest release..."
7+ $Version = (Invoke-RestMethod - Uri " https://api.github.com/repos/we-dcode/dcli/releases/latest" ).tag_name
8+ }
9+
10+ $Os = " windows"
11+ $Arch = " amd64"
12+ $ZipName = " dcli_${Version} _${Os} _${Arch} .zip"
13+ $DownloadUrl = " https://github.com/we-dcode/dcli/releases/download/$Version /$ZipName "
14+ $TargetDir = " C:\Program Files\Dcode"
15+ $TempZip = " $env: TEMP \dcli.zip"
16+
17+ Write-Host " 📦 Downloading dcli $Version for $Os /$Arch ..."
18+ Invoke-WebRequest - Uri $DownloadUrl - OutFile $TempZip
19+
20+ Write-Host " 📂 Extracting to $TargetDir ..."
21+ if (! (Test-Path - Path $TargetDir )) {
22+ New-Item - ItemType Directory - Path $TargetDir - Force | Out-Null
23+ }
24+
25+ Expand-Archive - Path $TempZip - DestinationPath $TargetDir - Force
26+
27+ Write-Host " ✅ dcli installed to '$TargetDir \dcli.exe'"
28+
29+ Write-Host " `n 👉 Add to PATH if needed:"
30+ Write-Host " setx PATH '`$ env:PATH;$TargetDir ' /M"
You can’t perform that action at this time.
0 commit comments