Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.

Give more information to suggestion function #103

@svick

Description

@svick

As far as I can tell, when specifying ArgumentsRule for an argument, the options for specifying suggestions are:

  • static list: public static ArgumentsRule WithSuggestionsFrom(this ArgumentsRule rule, params string[] values)
  • dynamic list based on the current value of the argument: public static ArgumentsRule WithSuggestionsFrom(this ArgumentsRule rule, Func<string, IEnumerable<string>> suggest)

But for https://github.com/dotnet/cli/issues/9172, I would like for the suggestion function to know not just the value of the argument being suggested, but also values of other arguments. That way, e.g. dotnet add package Microsoft.CodeAnalysis -v <Tab> could get the name of the package (Microsoft.CodeAnalysis) to query an API for a list of its versions.

The necessary information seems to be already contained in the ParseResult that's passed to ArgumentsRule.Suggest(), but there doesn't seem to be a way to access that from the suggestion function.

Or am I missing something and there is already a way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions