Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
49 changes: 37 additions & 12 deletions src/Aspire.Cli/Commands/ConfigCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,33 @@ private async Task<int> 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<bool> s_availableOption = new("--available")
{
Description = ConfigCommandStrings.ListCommand_AvailableOptionDescription
};

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_availableOption);
}

protected override bool UpdateNotificationsEnabled => false;

protected override Task<int> ExecuteAsync(ParseResult parseResult, CancellationToken cancellationToken)
{
return InteractiveExecuteAsync(cancellationToken);
var showAvailable = parseResult.GetValue(s_availableOption);
return ExecuteAsync(showAvailable, cancellationToken);
}

public override async Task<int> InteractiveExecuteAsync(CancellationToken cancellationToken)
public override Task<int> InteractiveExecuteAsync(CancellationToken cancellationToken)
{
return ExecuteAsync(showAvailable: false, cancellationToken);
}

private async Task<int> ExecuteAsync(bool showAvailable, CancellationToken cancellationToken)
{
if (InteractionService is ExtensionInteractionService extensionInteractionService)
{
Expand Down Expand Up @@ -256,16 +272,25 @@ public override async Task<int> InteractiveExecuteAsync(CancellationToken cancel

if (unconfiguredFeatures.Count > 0)
{
InteractionService.DisplayEmptyLine();
InteractionService.DisplayMarkdown($"**{ConfigCommandStrings.AvailableFeaturesHeader}:**");
foreach (var feature in unconfiguredFeatures)
if (showAvailable)
{
var defaultText = feature.DefaultValue ? "true" : "false";
InteractionService.DisplayMarkupLine($" [cyan]{feature.Name.EscapeMarkup()}[/] [dim](default: {defaultText})[/]");
InteractionService.DisplayMarkupLine($" [dim]{feature.Description.EscapeMarkup()}[/]");
InteractionService.DisplayEmptyLine();
InteractionService.DisplayMarkdown($"**{ConfigCommandStrings.AvailableFeaturesHeader}:**");
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.DisplayEmptyLine();
InteractionService.DisplayMarkdown($"**{ConfigCommandStrings.AvailableFeaturesHeader}:**");
InteractionService.DisplayMarkupLine($" [dim]{ConfigCommandStrings.ListCommand_AvailableFeaturesHint.EscapeMarkup()}[/]");
}
Comment thread
davidfowl marked this conversation as resolved.
InteractionService.DisplayEmptyLine();
InteractionService.DisplayMarkupLine($" [dim]{ConfigCommandStrings.SetFeatureHint.EscapeMarkup()}[/]");
}

return ExitCodeConstants.Success;
Expand Down
18 changes: 18 additions & 0 deletions src/Aspire.Cli/Resources/ConfigCommandStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/Aspire.Cli/Resources/ConfigCommandStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@
<data name="ListCommand_Description" xml:space="preserve">
<value>List all configuration values.</value>
</data>
<data name="ListCommand_AvailableOptionDescription" xml:space="preserve">
<value>Show all available features that can be configured.</value>
</data>
<data name="ListCommand_AvailableFeaturesHint" xml:space="preserve">
<value>Run 'aspire config list --available' to see all available feature flags.</value>
</data>
<data name="NoConfigurationValuesFound" xml:space="preserve">
<value>No configuration values found.</value>
</data>
Expand Down
10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/Aspire.Cli/Resources/xlf/ConfigCommandStrings.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading