Skip to content

Commit

Permalink
Merge pull request chocolatey#3067 from vexx32/2986-break-config-list
Browse files Browse the repository at this point in the history
(chocolatey#2986) Strip `config list` down to just config
  • Loading branch information
gep13 authored Mar 16, 2023
2 parents 8879f26 + a93195e commit 8021903
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 [<options/switches>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 6 additions & 27 deletions tests/chocolatey-tests/commands/choco-config.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 @(
Expand Down

0 comments on commit 8021903

Please sign in to comment.