Skip to content
Prev Previous commit
Next Next commit
Align arguments to the word completion
  • Loading branch information
jozkee committed Nov 8, 2022
commit 83a1c916571127c76dc5696ba8eae9e4245df683
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ System.CommandLine
public Argument AcceptLegalFileNamesOnly()
public Argument AcceptLegalFilePathsOnly()
public Argument AcceptOnlyFromAmong(System.String[] values)
public Argument AddCompletions(System.String[] values)
public Argument AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> complete)
public Argument AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>> complete)
public Argument AddCompletions(System.String[] completions)
public Argument AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> completionsDelegate)
public Argument AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>> completionsDelegate)
public System.Void AddValidator(System.Action<System.CommandLine.Parsing.ArgumentResult> validate)
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
public System.Object GetDefaultValue()
Expand Down Expand Up @@ -109,8 +109,8 @@ System.CommandLine
.ctor()
.ctor(System.String message, System.Exception innerException)
public static class CompletionSourceExtensions
public static System.Void Add(this System.Collections.Generic.ICollection<System.CommandLine.Completions.ICompletionSource> completionSources, System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> complete)
public static System.Void Add(this System.Collections.Generic.ICollection<System.CommandLine.Completions.ICompletionSource> completionSources, System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>> complete)
public static System.Void Add(this System.Collections.Generic.ICollection<System.CommandLine.Completions.ICompletionSource> completionSources, System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> completionsDelegate)
public static System.Void Add(this System.Collections.Generic.ICollection<System.CommandLine.Completions.ICompletionSource> completionSources, System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>> completionsDelegate)
public static System.Void Add(this System.Collections.Generic.ICollection<System.CommandLine.Completions.ICompletionSource> completionSources, System.String[] completions)
public static class ConsoleExtensions
public static System.Void Write(this IConsole console, System.String value)
Expand Down Expand Up @@ -197,9 +197,9 @@ System.CommandLine
public Option AcceptLegalFileNamesOnly()
public Option AcceptLegalFilePathsOnly()
public Option AcceptOnlyFromAmong(System.String[] values)
public Option AddCompletions(System.String[] values)
public Option AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> complete)
public Option AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>> complete)
public Option AddCompletions(System.String[] completions)
public Option AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.String>> completionsDelegate)
public Option AddCompletions(System.Func<System.CommandLine.Completions.CompletionContext,System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem>> completionsDelegate)
public System.Void AddValidator(System.Action<System.CommandLine.Parsing.OptionResult> validate)
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context)
public System.Boolean HasAliasIgnoringPrefix(System.String alias)
Expand Down
18 changes: 9 additions & 9 deletions src/System.CommandLine/Argument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,33 +207,33 @@ public override IEnumerable<CompletionItem> GetCompletions(CompletionContext con
/// <summary>
/// Adds completions for the argument.
/// </summary>
/// <param name="values">The completions to add.</param>
/// <param name="completions">The completions to add.</param>
/// <returns>The configured argument.</returns>
public Argument AddCompletions(params string[] values)
public Argument AddCompletions(params string[] completions)
{
Completions.Add(values);
Completions.Add(completions);
return this;
}

/// <summary>
/// Adds completions for the argument.
/// </summary>
/// <param name="complete">A function that will be called to provide completions.</param>
/// <param name="completionsDelegate">A function that will be called to provide completions.</param>
/// <returns>The option being extended.</returns>
public Argument AddCompletions(Func<CompletionContext, IEnumerable<string>> complete)
public Argument AddCompletions(Func<CompletionContext, IEnumerable<string>> completionsDelegate)
{
Completions.Add(complete);
Completions.Add(completionsDelegate);
return this;
}

/// <summary>
/// Adds completions for the argument.
/// </summary>
/// <param name="complete">A function that will be called to provide completions.</param>
/// <param name="completionsDelegate">A function that will be called to provide completions.</param>
/// <returns>The configured argument.</returns>
public Argument AddCompletions(Func<CompletionContext, IEnumerable<CompletionItem>> complete)
public Argument AddCompletions(Func<CompletionContext, IEnumerable<CompletionItem>> completionsDelegate)
{
Completions.Add(complete);
Completions.Add(completionsDelegate);
return this;
}

Expand Down
20 changes: 10 additions & 10 deletions src/System.CommandLine/CompletionSourceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,44 @@ public static class CompletionSourceExtensions
/// Adds a completion source using a delegate.
/// </summary>
/// <param name="completionSources">The list of completion sources to add to.</param>
/// <param name="complete">The delegate to be called when calculating completions.</param>
/// <param name="completionsDelegate">The delegate to be called when calculating completions.</param>
public static void Add(
this ICollection<ICompletionSource> completionSources,
Func<CompletionContext, IEnumerable<string>> complete)
Func<CompletionContext, IEnumerable<string>> completionsDelegate)
{
if (completionSources is null)
{
throw new ArgumentNullException(nameof(completionSources));
}

if (complete is null)
if (completionsDelegate is null)
{
throw new ArgumentNullException(nameof(complete));
throw new ArgumentNullException(nameof(completionsDelegate));
}

completionSources.Add(new AnonymousCompletionSource(complete));
completionSources.Add(new AnonymousCompletionSource(completionsDelegate));
}

/// <summary>
/// Adds a completion source using a delegate.
/// </summary>
/// <param name="completionSources">The list of completion sources to add to.</param>
/// <param name="complete">The function to be called when calculating completions.</param>
/// <param name="completionsDelegate">The function to be called when calculating completions.</param>
public static void Add(
this ICollection<ICompletionSource> completionSources,
Func<CompletionContext, IEnumerable<CompletionItem>> complete)
Func<CompletionContext, IEnumerable<CompletionItem>> completionsDelegate)
{
if (completionSources is null)
{
throw new ArgumentNullException(nameof(completionSources));
}

if (complete is null)
if (completionsDelegate is null)
{
throw new ArgumentNullException(nameof(complete));
throw new ArgumentNullException(nameof(completionsDelegate));
}

completionSources.Add(new AnonymousCompletionSource(complete));
completionSources.Add(new AnonymousCompletionSource(completionsDelegate));
}

/// <summary>
Expand Down
18 changes: 9 additions & 9 deletions src/System.CommandLine/Option.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,33 +253,33 @@ public Option AcceptOnlyFromAmong(params string[] values)
/// <summary>
/// Adds completions for the option.
/// </summary>
/// <param name="values">The completions to add.</param>
/// <param name="completions">The completions to add.</param>
/// <returns>The configured option.</returns>
public Option AddCompletions(params string[] values)
public Option AddCompletions(params string[] completions)
{
Argument.Completions.Add(values);
Argument.Completions.Add(completions);
return this;
}

/// <summary>
/// Adds completions for the option.
/// </summary>
/// <param name="complete">A function that will be called to provide completions.</param>
/// <param name="completionsDelegate">A function that will be called to provide completions.</param>
/// <returns>The configured option.</returns>
public Option AddCompletions(Func<CompletionContext, IEnumerable<string>> complete)
public Option AddCompletions(Func<CompletionContext, IEnumerable<string>> completionsDelegate)
{
Argument.Completions.Add(complete);
Argument.Completions.Add(completionsDelegate);
return this;
}

/// <summary>
/// Adds completions for the option.
/// </summary>
/// <param name="complete">A function that will be called to provide completions.</param>
/// <param name="completionsDelegate">A function that will be called to provide completions.</param>
/// <returns>The configured option.</returns>
public Option AddCompletions(Func<CompletionContext, IEnumerable<CompletionItem>> complete)
public Option AddCompletions(Func<CompletionContext, IEnumerable<CompletionItem>> completionsDelegate)
{
Argument.Completions.Add(complete);
Argument.Completions.Add(completionsDelegate);
return this;
}

Expand Down