Skip to content

Commit

Permalink
refact winget_install
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlivio committed Nov 23, 2024
1 parent 418f167 commit 4024adc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions os/win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ function win_install_nodejs_noadmin() {
}
}

function _winget_install() {
winget install --accept-package-agreements --accept-source-agreements --scope user -e --id $args
function _winget_install_agree_user_scope() {
winget install --accept-package-agreements --accept-source-agreements --scope user -e $args
}

function winget_install() {
param ([Parameter(Mandatory = $true)][string] $pkg)
winget list --accept-source-agreements -q $pkg | Out-Null
if (-not $?) {
_winget_install $pkg
_winget_install_agree_user_scope --id $pkg
}
}

Expand All @@ -225,15 +225,15 @@ function winget_install_at_location() {
)
winget list --accept-source-agreements -q $pkg | Out-Null
if (-not $?) {
_winget_install --location="$location" $pkg
_winget_install_agree_user_scope --id $pkg --location="$location"
}
}

function winget_uninstall() {
param ([Parameter(Mandatory = $true)][string] $pkg)
winget list --accept-source-agreements -q $pkg | Out-Null
if ($?) {
winget uninstall --silent "$pkg"
winget uninstall --id $pkg --silent
}
}

Expand Down

0 comments on commit 4024adc

Please sign in to comment.