Skip to content

Prompt for values #9807

@JamesNK

Description

@JamesNK

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

There are scenarios where values need to be supplied by the user before something can run correctly. To support getting these values at runtime, a service could be added that components or commands could use to ask for a value.

For example, a resource command might use extra arguments. An add-products command could ask how many products should be added, which is sent to the user (either via dashboard UI or command line), the user enters a value, the value is routed back to add-products, and the command completes.

Describe the solution you'd like

An API

public sealed class ValuePromptService
{
    public async Task<ValuePromptResult> PromptValueAsync(PromptedValue value, CancellationToken cancellationToken);
}

public sealed class PromptedValue
{
    public string Name { get; init; }
    public string DisplayText { get; init; }
    public PromptedValueType ValueType { get; init; }
    public List<object> Enum { get; init; }
}

public enum PromptedValueType
{
    String,
    Integer,
    Boolean
}

public sealed class ValuePromptResult
{
    public required bool Success { get; init; }
}

Additional context

No response

Metadata

Metadata

Assignees

Labels

area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationarea-cli

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions