Skip to content

Commit f19eb3e

Browse files
committed
Add update option for pwsh
1 parent 08ebb19 commit f19eb3e

1 file changed

Lines changed: 26 additions & 13 deletions

File tree

install.ps1

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ function ConfigureSSHKey() {
5050
function InstallWithWinget() {
5151
param(
5252
[string]$appId,
53-
[string]$alias
53+
[string]$alias,
54+
[switch]$update
5455
)
5556

5657
if (-not ([string]::IsNullOrEmpty($alias))) {
@@ -63,6 +64,9 @@ function InstallWithWinget() {
6364
if (-not $?) {
6465
Write-Host "$appId is not installed. Installing..." -ForegroundColor Yellow
6566
winget install -e --accept-source-agreements --accept-package-agreements --id $appId
67+
} elseif ($update) {
68+
Write-Host "Updating $appId..." -ForegroundColor Yellow
69+
winget upgrade --accept-source-agreements --id $appId
6670
}
6771
else {
6872
Write-Host "$appId is already installed" -ForegroundColor Green
@@ -82,9 +86,10 @@ function InstallPuroFVM {
8286
$puroBinary = "$env:temp\puro.exe"
8387
Invoke-WebRequest -Uri "https://puro.dev/builds/$tagName/windows-x64/puro.exe" -OutFile $puroBinary
8488

85-
if((Test-Path -Path $puroBinary)) {
89+
if ((Test-Path -Path $puroBinary)) {
8690
&"$puroBinary" install-puro --promote
87-
} else {
91+
}
92+
else {
8893
Write-Host "puro cannot be downloaded" -ForegroundColor Red
8994
}
9095

@@ -113,17 +118,25 @@ function InstallPython3 {
113118
function InstallMustHaveApps {
114119
### Start Installing must-have apps
115120
Write-Host "Installing must-have apps..." -ForegroundColor Cyan
121+
122+
# Pregunta si deseas actualizar las aplicaciones existentes
123+
$updateChoice = Read-Host "Do you want to update existing apps? (Y/N)"
124+
$updateFlag = $false
125+
if ($updateChoice -match "^[Yy]$") {
126+
$updateFlag = $true
127+
}
128+
116129
$installs = @(
117-
$(InstallWithWinget -appId "zyedidia.micro" -alias "micro"),
118-
$(InstallWithWinget -appId "lsd-rs.lsd" -alias "lsd"),
119-
$(InstallWithWinget -appId "sharkdp.bat" -alias "bat"),
120-
$(InstallWithWinget -appId "Fastfetch-cli.Fastfetch" -alias "fastfetch"),
121-
$(InstallWithWinget -appId "junegunn.fzf" -alias "fzf"),
122-
$(InstallWithWinget -appId "sharkdp.fd" -alias "fd"),
123-
$(InstallWithWinget -appId "dandavison.delta" -alias "delta"),
124-
$(InstallWithWinget -appId "Microsoft.VisualStudioCode" -alias "code"),
125-
$(InstallWithWinget -appId "Starship.Starship" -alias "starship"),
126-
$(InstallWithWinget -appId "Microsoft.PowerToys" -alias "")
130+
$(InstallWithWinget -appId "zyedidia.micro" -alias "micro" -update:$updateFlag),
131+
$(InstallWithWinget -appId "lsd-rs.lsd" -alias "lsd" -update:$updateFlag),
132+
$(InstallWithWinget -appId "sharkdp.bat" -alias "bat" -update:$updateFlag),
133+
$(InstallWithWinget -appId "Fastfetch-cli.Fastfetch" -alias "fastfetch" -update:$updateFlag),
134+
$(InstallWithWinget -appId "junegunn.fzf" -alias "fzf" -update:$updateFlag),
135+
$(InstallWithWinget -appId "sharkdp.fd" -alias "fd" -update:$updateFlag),
136+
$(InstallWithWinget -appId "dandavison.delta" -alias "delta" -update:$updateFlag),
137+
$(InstallWithWinget -appId "Microsoft.VisualStudioCode" -alias "code" -update:$updateFlag),
138+
$(InstallWithWinget -appId "Starship.Starship" -alias "starship" -update:$updateFlag),
139+
$(InstallWithWinget -appId "Microsoft.PowerToys" -alias "" -update:$updateFlag)
127140
)
128141

129142
foreach ($install in $installs) {

0 commit comments

Comments
 (0)