From a93195ede71110b1d3479b55f5a1fe67854f9ab0 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Wed, 15 Mar 2023 10:56:08 -0400 Subject: [PATCH] (#2986) Strip `config list` down to just config We have other commands for listing features, sources, apikeys, etc. Config can finally just be config. --- .../commands/ChocolateyConfigCommand.cs | 11 ------- .../ChocolateyConfigSettingsService.cs | 20 ----------- .../commands/choco-config.Tests.ps1 | 33 ++++--------------- 3 files changed, 6 insertions(+), 58 deletions(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index c191620889..245341a622 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -33,14 +33,6 @@ public class ChocolateyConfigCommand : ICommand { private readonly IChocolateyConfigSettingsService _configSettingsService; - internal const string DeprecatedConfigListResultsMessage = @" -Starting in v2.0.0, the `config list` command will only list the - configuration values, instead of also listing the configured features - and sources. - Use the `choco feature` or `choco source` commands to list and interact - with these values. -"; - public ChocolateyConfigCommand(IChocolateyConfigSettingsService configSettingsService) { _configSettingsService = configSettingsService; @@ -106,9 +98,6 @@ Chocolatey will allow you to interact with the configuration file settings. NOTE: Available in 0.9.9.9+. "); - this.Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE"); - this.Log().Warn(DeprecatedConfigListResultsMessage); - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); "chocolatey".Log().Info(@" choco config [list]|get|set|unset [] diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs index 7e0716ea2c..b814a16c50 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs @@ -370,26 +370,6 @@ public void config_list(ChocolateyConfiguration configuration) { this.Log().Info(() => "{0} = {1} | {2}".format_with(config.Key, config.Value, config.Description)); } - - this.Log().Info(""); - this.Log().Info(ChocolateyLoggers.Important, "Sources"); - this.Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE"); - this.Log().Warn(ChocolateyConfigCommand.DeprecatedConfigListResultsMessage); - source_list(configuration); - this.Log().Info(""); - this.Log().Info(@"NOTE: Use choco source to interact with sources."); - this.Log().Info(""); - this.Log().Info(ChocolateyLoggers.Important, "Features"); - this.Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE"); - this.Log().Warn(ChocolateyConfigCommand.DeprecatedConfigListResultsMessage); - feature_list(configuration); - this.Log().Info(""); - this.Log().Info(@"NOTE: Use choco feature to interact with features."); - ; - this.Log().Info(""); - this.Log().Info(ChocolateyLoggers.Important, "API Keys"); - this.Log().Info(@"NOTE: Api Keys are not shown through this command. - Use choco apikey to interact with API keys."); } public void config_get(ChocolateyConfiguration configuration) diff --git a/tests/chocolatey-tests/commands/choco-config.Tests.ps1 b/tests/chocolatey-tests/commands/choco-config.Tests.ps1 index 4f16f3db96..4f3c2399d3 100644 --- a/tests/chocolatey-tests/commands/choco-config.Tests.ps1 +++ b/tests/chocolatey-tests/commands/choco-config.Tests.ps1 @@ -102,37 +102,16 @@ Describe "choco config" -Tag Chocolatey, ConfigCommand { $Output.Lines | Should -Contain "Settings" } - It "Displays Sources section" { - $Output.Lines | Should -Contain "Sources" + It "Does not display Sources section" { + $Output.Lines | Should -Not -Contain "Sources" } - It "Displays Features" { - $Output.Lines | Should -Contain "Features" + It "Does not display Features" { + $Output.Lines | Should -Not -Contain "Features" } - It "Displays API Keys section" { - $Output.Lines | Should -Contain "API Keys" - } - - It "Displays note about choco <_>" -ForEach @( - "source" - "feature" - ) { - $Output.Lines | Should -Contain "NOTE: Use choco $_ to interact with $($_)s." - } - - It "Displays note about choco apikey" { - $Output.Lines | Should -Contain "NOTE: Api Keys are not shown through this command." - $Output.Lines | Should -Contain "Use choco apikey to interact with API keys." - } - - It "Displays deprecation note about sources and features" { - $pattern = @( - 'Starting in v2.0.0, the `config list` command will only list the' - ' configuration values, instead of also listing the configured features' - ' and sources.' - ) -join "\r?\n" - $Output.String | Should -Match $pattern + It "Does not display API Keys section" { + $Output.Lines | Should -Not -Contain "API Keys" } It "Displays Available Setting <_>" -ForEach @(