forked from chocolatey/ChocolateyGUI
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chocolateyGH-741 chocolateyGH-749) Add missing package parameters
I also switched to an helper.ps1 file for the package parameters to not go over the 100 lines guideline. Also the Package Parameter for UseDelayedSearch will now contain the correct value.
- Loading branch information
Showing
3 changed files
with
85 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
function Set-FeatureState { | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory=$true)] | ||
[string] $FeatureName, | ||
|
||
[Parameter(Mandatory=$true)] | ||
[bool] $EnableFeature | ||
) | ||
|
||
if ($EnableFeature) { | ||
Write-Output "Enabling $FeatureName..." | ||
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=$FeatureName" -ExeToRun "chocolateyguicli" | ||
} else { | ||
Write-Output "Disabling $FeatureName..." | ||
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=$FeatureName" -ExeToRun "chocolateyguicli" | ||
} | ||
} | ||
|
||
function Set-UserSettings { | ||
[CmdletBinding()] | ||
param( | ||
[hashtable]$pp = ( Get-PackageParameters ) | ||
|
||
) | ||
# Features | ||
if($pp.ContainsKey("ShowConsoleOutput")) { | ||
Set-FeatureState "ShowConsoleOutput" ($pp.ShowConsoleOutput -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("DefaultToTileViewForLocalSource")) { | ||
Set-FeatureState "DefaultToTileViewForLocalSource" ($pp.DefaultToTileViewForLocalSource -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("DefaultToTileViewForRemoteSource")) { | ||
Set-FeatureState "DefaultToTileViewForRemoteSource" ($pp.DefaultToTileViewForRemoteSource -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("UseDelayedSearch")) { | ||
Set-FeatureState "UseDelayedSearch" ($pp.UseDelayedSearch -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("PreventPreload")) { | ||
Set-FeatureState "PreventPreload" ($pp.PreventPreload -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("ExcludeInstalledPackages")) { | ||
Set-FeatureState "ExcludeInstalledPackages" ($pp.ExcludeInstalledPackages -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("ShowAggregatedSourceView")) { | ||
Set-FeatureState "ShowAggregatedSourceView" ($pp.ShowAggregatedSourceView -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("ShowAdditionalPackageInformation")) { | ||
Set-FeatureState "ShowAdditionalPackageInformation" ($pp.ShowAdditionalPackageInformation -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("AllowNonAdminAccessToSettings")) { | ||
Set-FeatureState "AllowNonAdminAccessToSettings" ($pp.AllowNonAdminAccessToSettings -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("UseKeyboardBindings")) { | ||
Set-FeatureState "UseKeyboardBindings" ($pp.UseKeyboardBindings -eq $true) | ||
} | ||
|
||
if($pp.ContainsKey("HidePackageDownloadCount")) { | ||
Set-FeatureState "HidePackageDownloadCount" ($pp.HidePackageDownloadCount -eq $true) | ||
} | ||
|
||
# config | ||
if($pp.ContainsKey("OutdatedPackagesCacheDurationInMinutes")) { | ||
Start-ChocolateyProcessAsAdmin -Statements "config set --name=OutdatedPackagesCacheDurationInMinutes --value=$($pp.OutdatedPackagesCacheDurationInMinutes)" -ExeToRun "chocolateyguicli" | ||
} | ||
} |