diff --git a/nuspec/chocolatey/ChocolateyGUI.nuspec b/nuspec/chocolatey/ChocolateyGUI.nuspec index 70665da35..9d1ac105a 100644 --- a/nuspec/chocolatey/ChocolateyGUI.nuspec +++ b/nuspec/chocolatey/ChocolateyGUI.nuspec @@ -29,8 +29,13 @@ Chocolatey GUI is a delicious GUI on top of the Chocolatey command line tool. - `/DefaultToTileViewForLocalSource` - Enables/disables whether or not Chocolatey GUI defauls to tile instead of list view for the local source view - `/DefaultToTileViewForRemoteSource` - Enables/disables whether or not Chocolatey GUI defauls to tile instead of list view for all remote source views - `/UseDelayedSearch` - Enables/disables whether or not Chocolatey GUI uses a live search, which returns results after a short delay without clicking the search button +- `/PreventPreload` - Prevents preloading results with a blank search when opening the remote source view. - `/ExcludeInstalledPackages` - Enables/disables whether or not Chocolatey GUI shows packages that are already installed when viewing sources - `/ShowAggregatedSourceView` - Enables/disables whether or not Chocolatey GUI shows an additional source combining all sources into one location +- `/ShowAdditionalPackageInformation` - Show additional package information on Local and Remote views. +- `/AllowNonAdminAccessToSettings` - Controls whether or not a non-administrator user can access the Settings Screen. NOTE: This feature will only work when using the licensed extension for Chocolatey and Chocolatey GUI. +- `/UseKeyboardBindings` - Allows keyboard bindings to be used to interact with different areas of the Chocolatey GUI User Interface. +- `/HidePackageDownloadCount` - Allows keyboard bindings to be used to interact with different areas of the Chocolatey GUI User Interface. - `/OutdatedPackagesCacheDurationInMinutes` - The length of time, in minutes, which Chocolatey GUI will wait before invalidating the cached result of outdated packages for the machine As an example, the following installation command could be used to enable `ShowConsoleOutput` to ensure `UseDelayedSearch` is disabled, and set the output cache to 120 minutes: diff --git a/nuspec/chocolatey/chocolateyInstall.ps1 b/nuspec/chocolatey/chocolateyInstall.ps1 index 79e1f910a..dd5c49b98 100644 --- a/nuspec/chocolatey/chocolateyInstall.ps1 +++ b/nuspec/chocolatey/chocolateyInstall.ps1 @@ -2,6 +2,9 @@ $ErrorActionPreference = 'Stop'; $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" $fileLocation = Join-Path $toolsDir 'ChocolateyGUI.msi' +if(!$PSScriptRoot){ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent } +. "$PSScriptRoot\helper.ps1" + $packageArgs = @{ packageName = $env:ChocolateyPackageName softwareName = 'Chocolatey GUI' @@ -22,52 +25,5 @@ if ($installDirectory) { Install-BinFile -Name "chocolateyguicli" -Path "$installDirectory\ChocolateyGuiCli.exe" } -$pp = Get-PackageParameters - -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" - } -} - -# 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.DefaultToTileViewForRemoteSource -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("OutdatedPackagesCacheDurationInMinutes")) { - Start-ChocolateyProcessAsAdmin -Statements "config set --name=OutdatedPackagesCacheDurationInMinutes --value=$($pp.OutdatedPackagesCacheDurationInMinutes)" -ExeToRun "chocolateyguicli" -} \ No newline at end of file +# Process package parameters +Set-UserSettings diff --git a/nuspec/chocolatey/helper.ps1 b/nuspec/chocolatey/helper.ps1 new file mode 100644 index 000000000..558a85c3e --- /dev/null +++ b/nuspec/chocolatey/helper.ps1 @@ -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" + } +} \ No newline at end of file