diff --git a/src/Aspire.Cli/Commands/ConfigCommand.cs b/src/Aspire.Cli/Commands/ConfigCommand.cs index 3e1597ae53a..6a55480308b 100644 --- a/src/Aspire.Cli/Commands/ConfigCommand.cs +++ b/src/Aspire.Cli/Commands/ConfigCommand.cs @@ -198,17 +198,33 @@ private async Task ExecuteAsync(string key, string value, bool isGlobal, Ca } } - private sealed class ListCommand(IConfigurationService configurationService, IInteractionService interactionService, IFeatures features, ICliUpdateNotifier updateNotifier, CliExecutionContext executionContext, AspireCliTelemetry telemetry) - : BaseConfigSubCommand("list", ConfigCommandStrings.ListCommand_Description, features, updateNotifier, configurationService, executionContext, interactionService, telemetry) + private sealed class ListCommand : BaseConfigSubCommand { + private static readonly Option s_allOption = new("--all") + { + Description = ConfigCommandStrings.ListCommand_AllOptionDescription + }; + + public ListCommand(IConfigurationService configurationService, IInteractionService interactionService, IFeatures features, ICliUpdateNotifier updateNotifier, CliExecutionContext executionContext, AspireCliTelemetry telemetry) + : base("list", ConfigCommandStrings.ListCommand_Description, features, updateNotifier, configurationService, executionContext, interactionService, telemetry) + { + Options.Add(s_allOption); + } + protected override bool UpdateNotificationsEnabled => false; protected override Task ExecuteAsync(ParseResult parseResult, CancellationToken cancellationToken) { - return InteractiveExecuteAsync(cancellationToken); + var showAll = parseResult.GetValue(s_allOption); + return ExecuteAsync(showAll, cancellationToken); } - public override async Task InteractiveExecuteAsync(CancellationToken cancellationToken) + public override Task InteractiveExecuteAsync(CancellationToken cancellationToken) + { + return ExecuteAsync(showAll: false, cancellationToken); + } + + private async Task ExecuteAsync(bool showAll, CancellationToken cancellationToken) { if (InteractionService is ExtensionInteractionService extensionInteractionService) { @@ -258,14 +274,22 @@ public override async Task InteractiveExecuteAsync(CancellationToken cancel { InteractionService.DisplayEmptyLine(); InteractionService.DisplayMarkdown($"**{ConfigCommandStrings.AvailableFeaturesHeader}:**"); - foreach (var feature in unconfiguredFeatures) + + if (showAll) { - var defaultText = feature.DefaultValue ? "true" : "false"; - InteractionService.DisplayMarkupLine($" [cyan]{feature.Name.EscapeMarkup()}[/] [dim](default: {defaultText})[/]"); - InteractionService.DisplayMarkupLine($" [dim]{feature.Description.EscapeMarkup()}[/]"); + foreach (var feature in unconfiguredFeatures) + { + var defaultText = feature.DefaultValue ? "true" : "false"; + InteractionService.DisplayMarkupLine($" [cyan]{feature.Name.EscapeMarkup()}[/] [dim](default: {defaultText})[/]"); + InteractionService.DisplayMarkupLine($" [dim]{feature.Description.EscapeMarkup()}[/]"); + } + InteractionService.DisplayEmptyLine(); + InteractionService.DisplayMarkupLine($" [dim]{ConfigCommandStrings.SetFeatureHint.EscapeMarkup()}[/]"); + } + else + { + InteractionService.DisplayMarkupLine($" [dim]{ConfigCommandStrings.ListCommand_AllFeaturesHint.EscapeMarkup()}[/]"); } - InteractionService.DisplayEmptyLine(); - InteractionService.DisplayMarkupLine($" [dim]{ConfigCommandStrings.SetFeatureHint.EscapeMarkup()}[/]"); } return ExitCodeConstants.Success; diff --git a/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs b/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs index 0b0f0af33dd..1c332164fb6 100644 --- a/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs +++ b/src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs @@ -194,6 +194,24 @@ public static string ListCommand_Description { } } + /// + /// Looks up a localized string similar to Show all available features that can be configured.. + /// + public static string ListCommand_AllOptionDescription { + get { + return ResourceManager.GetString("ListCommand_AllOptionDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Run 'aspire config list --all' to see all available feature flags.. + /// + public static string ListCommand_AllFeaturesHint { + get { + return ResourceManager.GetString("ListCommand_AllFeaturesHint", resourceCulture); + } + } + /// /// Looks up a localized string similar to No configuration values found.. /// diff --git a/src/Aspire.Cli/Resources/ConfigCommandStrings.resx b/src/Aspire.Cli/Resources/ConfigCommandStrings.resx index 93f43755fca..2bf92609924 100644 --- a/src/Aspire.Cli/Resources/ConfigCommandStrings.resx +++ b/src/Aspire.Cli/Resources/ConfigCommandStrings.resx @@ -138,6 +138,12 @@ List all configuration values. + + Show all available features that can be configured. + + + Run 'aspire config list --all' to see all available feature flags. + No configuration values found. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf index 0720a9f8793..5a1314f5490 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf @@ -112,6 +112,16 @@ Vlastnosti souboru nastavení + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Umožňuje vypsat všechny hodnoty konfigurace. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf index 1810746b81f..2912dbf55b2 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf @@ -112,6 +112,16 @@ Eigenschaften der Einstellungsdatei + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Listen Sie alle Konfigurationswerte auf. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf index 890b10650de..843d6282868 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf @@ -112,6 +112,16 @@ Propiedades del archivo de configuración + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Enumera todos los valores de configuración. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf index 53d4a40801d..9ebe71d009d 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf @@ -112,6 +112,16 @@ Propriétés du fichier de paramètres + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Répertoriez toutes les valeurs de configuration. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf index 38fa936d4da..38ddbdca403 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf @@ -112,6 +112,16 @@ Proprietà del file di impostazioni + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Elenca tutti i valori di configurazione. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf index be4175925d8..06024abaa7b 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf @@ -112,6 +112,16 @@ 設定ファイルのプロパティ + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. すべての構成値を一覧表示します。 diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf index 60ad7b23817..4ebb62b57ec 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf @@ -112,6 +112,16 @@ 설정 파일 속성 + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. 모든 구성 값을 나열합니다. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf index 0ee5b7b05db..6cba6742b6c 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf @@ -112,6 +112,16 @@ Właściwości pliku ustawień + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Wyświetl listę wszystkich wartości konfiguracji. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf index c3f52487aa5..f1ef8de41d0 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf @@ -112,6 +112,16 @@ Propriedades do arquivo de configurações + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Liste todos os valores de configuração. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf index 2fdd373187d..eaa02f80bf9 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf @@ -112,6 +112,16 @@ Свойства файла параметров + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Перечислить все значения конфигурации. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf index 94be09448c1..124571f3492 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf @@ -112,6 +112,16 @@ Ayar dosyası özellikleri + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. Tüm yapılandırma değerlerini listeleyin. diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf index dcfffcf23f2..54d9073bf28 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf @@ -112,6 +112,16 @@ 设置文件属性 + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. 列出所有配置值。 diff --git a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf index a434ca4bf9c..3bc217c630f 100644 --- a/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf +++ b/src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf @@ -112,6 +112,16 @@ 設定檔案屬性 + + Run 'aspire config list --all' to see all available feature flags. + Run 'aspire config list --all' to see all available feature flags. + + + + Show all available features that can be configured. + Show all available features that can be configured. + + List all configuration values. 列出所有設定值。 diff --git a/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs index 8bd2d2fab37..5be0b2837f1 100644 --- a/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs +++ b/tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs @@ -307,6 +307,58 @@ public async Task ConfigListCommand_ShowsFlattenedDotNotationKeys() Assert.Equal(0, listExitCode); } + [Fact] + public async Task ConfigListCommand_WithoutAllFlag_ShowsHintInsteadOfFeatures() + { + using var workspace = TemporaryWorkspace.Create(outputHelper); + var outputWriter = new TestOutputTextWriter(outputHelper); + var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, options => + { + options.OutputTextWriter = outputWriter; + }); + var provider = services.BuildServiceProvider(); + + var command = provider.GetRequiredService(); + + // Set a value so config list has something to display + var setResult = command.Parse("config set testkey testvalue"); + await setResult.InvokeAsync().DefaultTimeout(); + + // List without --all + var listResult = command.Parse("config list"); + var listExitCode = await listResult.InvokeAsync().DefaultTimeout(); + Assert.Equal(0, listExitCode); + + var output = string.Join("\n", outputWriter.Logs); + Assert.Contains("--all", output); + } + + [Fact] + public async Task ConfigListCommand_WithAllFlag_ShowsFeatureDetails() + { + using var workspace = TemporaryWorkspace.Create(outputHelper); + var outputWriter = new TestOutputTextWriter(outputHelper); + var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, options => + { + options.OutputTextWriter = outputWriter; + }); + var provider = services.BuildServiceProvider(); + + var command = provider.GetRequiredService(); + + // Set a value so config list has something to display + var setResult = command.Parse("config set testkey testvalue"); + await setResult.InvokeAsync().DefaultTimeout(); + + // List with --all + var listResult = command.Parse("config list --all"); + var listExitCode = await listResult.InvokeAsync().DefaultTimeout(); + Assert.Equal(0, listExitCode); + + var output = string.Join("\n", outputWriter.Logs); + Assert.Contains("default:", output); + } + [Fact] public async Task FeatureFlags_WhenSetToTrue_ReturnsTrue() {