Edit

Share via


ArgumentExtensions.AddCompletions Method

Definition

Overloads

AddCompletions<TArgument>(TArgument, CompletionDelegate)

Source:
ArgumentExtensions.cs

Adds completions for an argument.

C#
public static TArgument AddCompletions<TArgument>(this TArgument argument, System.CommandLine.Completions.CompletionDelegate complete) where TArgument : System.CommandLine.Argument;

Type Parameters

TArgument

The type of the argument.

Parameters

argument
TArgument

The argument for which to add completions.

complete
CompletionDelegate

A CompletionDelegate that will be called to provide completions.

Returns

TArgument

The configured argument.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

AddCompletions<TArgument>(TArgument, Func<CompletionContext,IEnumerable<String>>)

Source:
ArgumentExtensions.cs

Adds completions for an option.

C#
public static TArgument AddCompletions<TArgument>(this TArgument argument, Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<string>> complete) where TArgument : System.CommandLine.Argument;

Type Parameters

TArgument

The type of the argument.

Parameters

argument
TArgument

The argument for which to add completions.

complete
Func<CompletionContext,IEnumerable<String>>

A CompletionDelegate that will be called to provide completions.

Returns

TArgument

The option being extended.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

AddCompletions<TArgument>(TArgument, String[])

Source:
ArgumentExtensions.cs

Adds completions for an argument.

C#
public static TArgument AddCompletions<TArgument>(this TArgument argument, params string[] values) where TArgument : System.CommandLine.Argument;

Type Parameters

TArgument

The type of the argument.

Parameters

argument
TArgument

The argument for which to add completions.

values
String[]

The completions to add.

Returns

TArgument

The configured argument.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)