Skip to content
Draft
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
31 changes: 31 additions & 0 deletions src/code/ArgumentCompleter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,37 @@
using System.Management.Automation;
using System.Management.Automation.Language;

internal class TargetFrameworkCompleter : IArgumentCompleter
{
private static readonly string[] s_knownTargetFrameworks = new[]
{
"net462", "net472", "net48",
"netstandard2.0", "netstandard2.1",
"net6.0", "net7.0", "net8.0", "net9.0", "net10.0",
};

public IEnumerable<CompletionResult> CompleteArgument(
string commandName,
string parameterName,
string wordToComplete,
CommandAst commandAst,
IDictionary fakeBoundParameters)
{
wordToComplete = Utils.TrimQuotes(wordToComplete);
var wordToCompletePattern = WildcardPattern.Get(
pattern: string.IsNullOrWhiteSpace(wordToComplete) ? "*" : wordToComplete + "*",
options: WildcardOptions.IgnoreCase);

foreach (string targetFramework in s_knownTargetFrameworks)
{
if (wordToCompletePattern.IsMatch(targetFramework))
{
yield return new CompletionResult(targetFramework);
}
}
}
}

internal class RepositoryNameCompleter : IArgumentCompleter
{
public IEnumerable<CompletionResult> CompleteArgument(
Expand Down
Loading
Loading