Skip to content

Commit a978dad

Browse files
authored
Create Install.ps1
1 parent 52c8a70 commit a978dad

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Install.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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"

0 commit comments

Comments
 (0)