Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2986) Strip config list down to just config #3067

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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