diff --git a/src/System.CommandLine/Argument.cs b/src/System.CommandLine/Argument.cs
index 8cdce978a8..8c8ccf7c09 100644
--- a/src/System.CommandLine/Argument.cs
+++ b/src/System.CommandLine/Argument.cs
@@ -12,6 +12,8 @@ namespace System.CommandLine
///
/// A symbol defining a value that can be passed on the command line to a command or option .
///
+ /// Command-line syntax overview
+ /// How to define commands, options, and arguments
public abstract class Argument : Symbol, IValueDescriptor
{
private Func? _defaultValueFactory;
@@ -23,6 +25,7 @@ public abstract class Argument : Symbol, IValueDescriptor
///
/// Initializes a new instance of the Argument class.
///
+ /// How to define commands, options, and arguments
protected Argument()
{
}
@@ -32,6 +35,7 @@ protected Argument()
///
/// The name of the argument.
/// The description of the argument, shown in help.
+ /// How to define commands, options, and arguments
protected Argument(string? name = null, string? description = null)
{
Name = name!;
@@ -41,8 +45,9 @@ protected Argument(string? name = null, string? description = null)
internal HashSet? AllowedValues { get; private set; }
///
- /// Gets or sets the arity of the argument.
+ /// Gets or sets the arity of the argument.
///
+ /// How to define commands, options, and arguments
public ArgumentArity Arity
{
get
@@ -63,6 +68,7 @@ public ArgumentArity Arity
///
/// The name used in help output to describe the argument.
///
+ /// How to customize help
public string? HelpName { get; set; }
internal TryConvertArgument? ConvertArguments
@@ -83,6 +89,7 @@ internal TryConvertArgument? ConvertArguments
///
/// Gets or sets the that the argument token(s) will be converted to.
///
+ /// How to define commands, options, and arguments
public abstract Type ValueType { get; }
private protected override string DefaultName
@@ -111,13 +118,15 @@ private protected override string DefaultName
/// to provide custom errors based on user input.
///
/// The delegate to validate the parsed argument.
+ /// How to bind arguments to handlers - Custom validation and binding
public void AddValidator(ValidateSymbolResult validate) => Validators.Add(validate);
///
/// Gets the default value for the argument.
///
/// Returns the default value for the argument, if defined. Null otherwise.
- public object? GetDefaultValue()
+ /// How to define commands, options, and arguments
+ public object? GetDefaultValue()
{
return GetDefaultValue(new ArgumentResult(this, null));
}
@@ -136,6 +145,7 @@ private protected override string DefaultName
/// Sets the default value for the argument.
///
/// The default value for the argument.
+ /// How to define commands, options, and arguments
public void SetDefaultValue(object? value)
{
SetDefaultValueFactory(() => value);
@@ -146,6 +156,7 @@ public void SetDefaultValue(object? value)
///
/// The delegate to invoke to return the default value.
/// Thrown when is null.
+ /// How to define commands, options, and arguments
public void SetDefaultValueFactory(Func getDefaultValue)
{
if (getDefaultValue is null)
@@ -161,6 +172,7 @@ public void SetDefaultValueFactory(Func getDefaultValue)
///
/// The delegate to invoke to return the default value.
/// In this overload, the is provided to the delegate.
+ /// How to define commands, options, and arguments
public void SetDefaultValueFactory(Func getDefaultValue)
{
_defaultValueFactory = getDefaultValue ?? throw new ArgumentNullException(nameof(getDefaultValue));
@@ -169,6 +181,7 @@ public void SetDefaultValueFactory(Func getDefaultValue
///
/// Specifies if a default value is defined for the argument.
///
+ /// How to define commands, options, and arguments
public bool HasDefaultValue => _defaultValueFactory is not null;
internal virtual bool HasCustomParser => false;
diff --git a/src/System.CommandLine/ArgumentArity.cs b/src/System.CommandLine/ArgumentArity.cs
index c0153fc86e..ef0230e24c 100644
--- a/src/System.CommandLine/ArgumentArity.cs
+++ b/src/System.CommandLine/ArgumentArity.cs
@@ -9,10 +9,11 @@
namespace System.CommandLine
{
///
- /// Defines the arity of an option or argument.
+ /// Defines the arity of an option or argument.
///
/// The arity refers to the number of values that can be passed on the command line.
///
+ /// Command-line syntax overview
[DebuggerDisplay("\\{{" + nameof(MinimumNumberOfValues) + "},{" + nameof(MaximumNumberOfValues) + "}\\}")]
public readonly struct ArgumentArity : IEquatable
{
@@ -25,6 +26,7 @@ namespace System.CommandLine
/// The maximum number of values allowed for the argument.
/// Thrown when is negative.
/// Thrown when the maximum number is less than the minimum number or the maximum number is greater than MaximumArity.
+ /// Command-line syntax overview
public ArgumentArity(int minimumNumberOfValues, int maximumNumberOfValues)
{
if (minimumNumberOfValues < 0)
@@ -50,11 +52,13 @@ public ArgumentArity(int minimumNumberOfValues, int maximumNumberOfValues)
///
/// Gets the minimum number of values required for an argument .
///
+ /// Command-line syntax overview
public int MinimumNumberOfValues { get; }
///
/// Gets the maximum number of values allowed for an argument .
///
+ /// Command-line syntax overview
public int MaximumNumberOfValues { get; }
internal bool IsNonDefault { get; }
@@ -119,26 +123,31 @@ public override int GetHashCode()
///
/// An arity that does not allow any values.
///
+ /// Command-line syntax overview
public static ArgumentArity Zero => new(0, 0);
///
/// An arity that may have one value, but no more than one.
///
+ /// Command-line syntax overview
public static ArgumentArity ZeroOrOne => new(0, 1);
///
/// An arity that must have exactly one value.
///
+ /// Command-line syntax overview
public static ArgumentArity ExactlyOne => new(1, 1);
///
/// An arity that may have multiple values.
///
+ /// Command-line syntax overview
public static ArgumentArity ZeroOrMore => new(0, MaximumArity);
///
/// An arity that must have at least one value.
///
+ /// Command-line syntax overview
public static ArgumentArity OneOrMore => new(1, MaximumArity);
internal static ArgumentArity Default(Type type, Argument argument, ParentNode? firstParent)
diff --git a/src/System.CommandLine/ArgumentExtensions.cs b/src/System.CommandLine/ArgumentExtensions.cs
index 3d153dd346..247fdb0b91 100644
--- a/src/System.CommandLine/ArgumentExtensions.cs
+++ b/src/System.CommandLine/ArgumentExtensions.cs
@@ -11,6 +11,8 @@ namespace System.CommandLine
///
/// Provides extension methods for .
///
+ /// Command-line syntax overview
+ /// How to define commands, options, and arguments
public static class ArgumentExtensions
{
///
@@ -20,6 +22,7 @@ public static class ArgumentExtensions
/// The argument for which to add completions.
/// The completions to add.
/// The configured argument.
+ /// Tab completion
public static TArgument AddCompletions(
this TArgument argument,
params string[] values)
@@ -37,6 +40,7 @@ public static TArgument AddCompletions(
/// The argument for which to add completions.
/// A that will be called to provide completions.
/// The option being extended.
+ /// Tab completion
public static TArgument AddCompletions(
this TArgument argument,
Func> complete)
@@ -54,6 +58,7 @@ public static TArgument AddCompletions(
/// The argument for which to add completions.
/// A that will be called to provide completions.
/// The configured argument.
+ /// Tab completion
public static TArgument AddCompletions(
this TArgument argument,
CompletionDelegate complete)
@@ -71,6 +76,8 @@ public static TArgument AddCompletions(
/// The values that are allowed for the argument.
/// The type of the argument.
/// The configured argument.
+ /// How to define commands, options, and arguments
+ /// Tab completion
public static TArgument FromAmong(
this TArgument argument,
params string[] values)
@@ -87,6 +94,7 @@ public static TArgument FromAmong(
///
/// The argument to configure.
/// The configured argument.
+ /// How to bind arguments to handlers
public static Argument ExistingOnly(this Argument argument)
{
argument.AddValidator(Validate.FileExists);
@@ -98,6 +106,7 @@ public static Argument ExistingOnly(this Argument argument)
///
/// The argument to configure.
/// The configured argument.
+ /// How to bind arguments to handlers
public static Argument ExistingOnly(this Argument argument)
{
argument.AddValidator(Validate.DirectoryExists);
@@ -109,6 +118,7 @@ public static Argument ExistingOnly(this Argument
///
/// The argument to configure.
/// The configured argument.
+ /// How to bind arguments to handlers
public static Argument ExistingOnly(this Argument argument)
{
argument.AddValidator(Validate.FileOrDirectoryExists);
@@ -120,6 +130,7 @@ public static Argument ExistingOnly(this Argument
/// The argument to configure.
/// The configured argument.
+ /// How to bind arguments to handlers
public static Argument ExistingOnly(this Argument argument)
where T : IEnumerable
{
@@ -144,6 +155,7 @@ public static Argument ExistingOnly(this Argument argument)
///
/// The argument to configure.
/// The configured argument.
+ /// How to bind arguments to handlers
public static TArgument LegalFilePathsOnly(
this TArgument argument)
where TArgument : Argument
@@ -176,6 +188,7 @@ public static TArgument LegalFilePathsOnly(
/// A parse error will result, for example, if file path separators are found in the parsed value.
/// The argument to configure.
/// The configured argument.
+ /// How to bind arguments to handlers
public static TArgument LegalFileNamesOnly(
this TArgument argument)
where TArgument : Argument
@@ -206,6 +219,7 @@ public static TArgument LegalFileNamesOnly(
/// The argument to use to parse the command line input.
/// A command line string to parse, which can include spaces and quotes equivalent to what can be entered into a terminal.
/// A parse result describing the outcome of the parse operation.
+ /// Command-line syntax overview - Directives
public static ParseResult Parse(
this Argument argument,
string commandLine) =>
@@ -217,6 +231,7 @@ public static ParseResult Parse(
/// The argument to use to parse the command line input.
/// The string arguments to parse.
/// A parse result describing the outcome of the parse operation.
+ /// Command-line syntax overview - Directives
public static ParseResult Parse(
this Argument argument,
string[] args) =>
diff --git a/src/System.CommandLine/Argument{T}.cs b/src/System.CommandLine/Argument{T}.cs
index 1746281d69..cffc54b5ee 100644
--- a/src/System.CommandLine/Argument{T}.cs
+++ b/src/System.CommandLine/Argument{T}.cs
@@ -14,6 +14,7 @@ public class Argument : Argument, IValueDescriptor
///
/// Initializes a new instance of the Argument class.
///
+ /// How to define commands, options, and arguments
public Argument()
{
}
@@ -32,6 +33,7 @@ public Argument(
/// The delegate to invoke to return the default value.
/// The description of the argument, shown in help.
/// Thrown when is null.
+ /// How to define commands, options, and arguments
public Argument(
string name,
Func getDefaultValue,
@@ -50,6 +52,7 @@ public Argument(
///
/// The delegate to invoke to return the default value.
/// Thrown when is null.
+ /// How to define commands, options, and arguments
public Argument(Func getDefaultValue) : this()
{
if (getDefaultValue is null)
@@ -68,6 +71,7 @@ public Argument(Func getDefaultValue) : this()
/// to use the result as default value.
/// The description of the argument, shown in help.
/// Thrown when is null.
+ /// How to define commands, options, and arguments
public Argument(
string? name,
ParseArgument parse,
@@ -108,6 +112,7 @@ public Argument(
///
/// A custom argument parser.
/// to use the result as default value.
+ /// How to define commands, options, and arguments
public Argument(ParseArgument parse, bool isDefault = false) : this(null!, parse, isDefault)
{
}
diff --git a/src/System.CommandLine/Binding/BinderBase{T}.cs b/src/System.CommandLine/Binding/BinderBase{T}.cs
index 31dcb1baac..c10e3654ed 100644
--- a/src/System.CommandLine/Binding/BinderBase{T}.cs
+++ b/src/System.CommandLine/Binding/BinderBase{T}.cs
@@ -4,6 +4,8 @@
/// Supports binding of custom types.
///
/// The type to be bound.
+/// Model binding more than 16 options and arguments
+
public abstract class BinderBase :
IValueDescriptor,
IValueSource
@@ -13,6 +15,7 @@ public abstract class BinderBase :
///
///
///
+ /// Model binding more than 16 options and arguments
protected abstract T GetBoundValue(BindingContext bindingContext);
string IValueDescriptor.ValueName => GetType().Name;
diff --git a/src/System.CommandLine/Binding/BindingContext.cs b/src/System.CommandLine/Binding/BindingContext.cs
index 7f2cbb5ca3..c3efef50e4 100644
--- a/src/System.CommandLine/Binding/BindingContext.cs
+++ b/src/System.CommandLine/Binding/BindingContext.cs
@@ -14,6 +14,8 @@ namespace System.CommandLine.Binding
///
/// Creates object instances based on command line parser results, injected services, and other value sources.
///
+ /// How to bind arguments to handlers
+
public sealed class BindingContext : IServiceProvider
{
private HelpBuilder? _helpBuilder;
diff --git a/src/System.CommandLine/Binding/BoundValue.cs b/src/System.CommandLine/Binding/BoundValue.cs
index ba50a45a4e..f50a574111 100644
--- a/src/System.CommandLine/Binding/BoundValue.cs
+++ b/src/System.CommandLine/Binding/BoundValue.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Binding
///
/// A value created by binding command line input.
///
+ /// How to bind arguments to handlers
public readonly struct BoundValue
{
internal BoundValue(
diff --git a/src/System.CommandLine/Builder/CommandLineBuilder.cs b/src/System.CommandLine/Builder/CommandLineBuilder.cs
index 959fcecdca..c7da738420 100644
--- a/src/System.CommandLine/Builder/CommandLineBuilder.cs
+++ b/src/System.CommandLine/Builder/CommandLineBuilder.cs
@@ -12,6 +12,7 @@ namespace System.CommandLine.Builder
///
/// Enables composition of command line configurations.
///
+ /// How to customize help
public class CommandLineBuilder
{
// for every generic type with type argument being struct JIT needs to compile a dedicated version
diff --git a/src/System.CommandLine/Command.cs b/src/System.CommandLine/Command.cs
index 4f9cfc7cd8..43f6b0f133 100644
--- a/src/System.CommandLine/Command.cs
+++ b/src/System.CommandLine/Command.cs
@@ -18,6 +18,7 @@ namespace System.CommandLine
/// for simple applications that only have one action. For example, dotnet run
/// uses run as the command.
///
+ /// Command-line syntax overview
public class Command : IdentifierSymbol, IEnumerable
{
private List? _arguments;
@@ -30,6 +31,7 @@ public class Command : IdentifierSymbol, IEnumerable
///
/// The name of the command.
/// The description of the command, shown in help.
+ /// Command-line syntax overview
public Command(string name, string? description = null) : base(name, description)
{
}
@@ -37,6 +39,7 @@ public Command(string name, string? description = null) : base(name, description
///
/// Gets the child symbols.
///
+ /// Command-line syntax overview
public IEnumerable Children
{
get
@@ -55,6 +58,7 @@ public IEnumerable Children
///
/// Represents all of the arguments for the command.
///
+ /// Command-line syntax overview
public IReadOnlyList Arguments => _arguments is not null ? _arguments : Array.Empty();
internal bool HasArguments => _arguments is not null;
@@ -62,11 +66,13 @@ public IEnumerable Children
///
/// Represents all of the options for the command, including global options that have been applied to any of the command's ancestors.
///
+ /// Command-line syntax overview
public IReadOnlyList Options => _options is not null ? _options : Array.Empty ();
///
/// Represents all of the subcommands for the command.
///
+ /// Command-line syntax overview
public IReadOnlyList Subcommands => _subcommands is not null ? _subcommands : Array.Empty();
internal IReadOnlyList> Validators
@@ -78,6 +84,7 @@ internal IReadOnlyList> Validators
/// Adds an to the command.
///
/// The argument to add to the command.
+ /// How to define commands, options, and arguments
public void AddArgument(Argument argument)
{
argument.AddParent(this);
@@ -89,6 +96,7 @@ public void AddArgument(Argument argument)
///
/// The subcommand to add to the command.
/// Commands can be nested to an arbitrary depth.
+ /// How to define commands, options, and arguments
public void AddCommand(Command command)
{
command.AddParent(this);
@@ -99,6 +107,7 @@ public void AddCommand(Command command)
/// Adds an to the command.
///
/// The option to add to the command.
+ /// How to define commands, options, and arguments
public void AddOption(Option option)
{
option.AddParent(this);
@@ -111,6 +120,7 @@ public void AddOption(Option option)
/// The global option to add to the command.
/// Global options are applied to the command and recursively to subcommands. They do not apply to
/// parent commands.
+ /// How to define commands, options, and arguments
public void AddGlobalOption(Option option)
{
option.IsGlobal = true;
@@ -120,12 +130,14 @@ public void AddGlobalOption(Option option)
/// Adds an to the command.
///
/// The option to add to the command.
+ /// How to define commands, options, and arguments
public void Add(Option option) => AddOption(option);
///
/// Adds an to the command.
///
/// The argument to add to the command.
+ /// How to define commands, options, and arguments
public void Add(Argument argument) => AddArgument(argument);
///
@@ -133,6 +145,7 @@ public void AddGlobalOption(Option option)
///
/// The subcommand to add to the command.
/// Commands can be nested to an arbitrary depth.
+ /// How to define commands, options, and arguments
public void Add(Command command) => AddCommand(command);
private protected override string DefaultName => throw new NotImplementedException();
@@ -142,6 +155,7 @@ public void AddGlobalOption(Option option)
/// to create custom validation logic.
///
/// The delegate to validate the symbols during parsing.
+ /// How to bind arguments to handlers - Custom validation and binding
public void AddValidator(ValidateSymbolResult validate) => (_validators ??= new()).Add(validate);
///
@@ -149,6 +163,7 @@ public void AddGlobalOption(Option option)
/// if set to and an extra command or argument is provided, validation will fail.
///
public bool TreatUnmatchedTokensAsErrors { get; set; } = true;
+ /// Command-line syntax overview
///
/// Gets or sets the for the command. The handler represents the action
@@ -158,11 +173,13 @@ public void AddGlobalOption(Option option)
/// Use one of the overloads to construct a handler.
/// If the handler is not specified, parser errors will be generated for command line input that
/// invokes this command.
+ /// How to bind arguments to handlers
public ICommandHandler? Handler { get; set; }
///
/// Represents all of the symbols for the command.
///
+ /// Command-line syntax overview
public IEnumerator GetEnumerator() => Children.GetEnumerator();
///
diff --git a/src/System.CommandLine/CommandExtensions.cs b/src/System.CommandLine/CommandExtensions.cs
index 1a50cd0873..6ea9515c29 100644
--- a/src/System.CommandLine/CommandExtensions.cs
+++ b/src/System.CommandLine/CommandExtensions.cs
@@ -20,6 +20,7 @@ public static class CommandExtensions
/// The arguments to parse.
/// The console to which output is written during invocation.
/// The exit code for the invocation.
+ /// How to bind arguments to handlers
public static int Invoke(
this Command command,
string[] args,
@@ -36,6 +37,7 @@ public static int Invoke(
/// The command line to parse.
/// The console to which output is written during invocation.
/// The exit code for the invocation.
+ /// How to bind arguments to handlers
public static int Invoke(
this Command command,
string commandLine,
@@ -49,6 +51,7 @@ public static int Invoke(
/// The arguments to parse.
/// The console to which output is written during invocation.
/// The exit code for the invocation.
+ /// How to bind arguments to handlers
public static async Task InvokeAsync(
this Command command,
string[] args,
@@ -65,6 +68,7 @@ public static async Task InvokeAsync(
/// The command line to parse.
/// The console to which output is written during invocation.
/// The exit code for the invocation.
+ /// How to bind arguments to handlers
public static Task InvokeAsync(
this Command command,
string commandLine,
@@ -84,6 +88,7 @@ private static InvocationPipeline GetDefaultInvocationPipeline(Command command,
/// The command to use to parse the command line input.
/// The string arguments to parse.
/// A parse result describing the outcome of the parse operation.
+ /// Command-line syntax overview
public static ParseResult Parse(
this Command command,
params string[] args) =>
@@ -96,6 +101,7 @@ public static ParseResult Parse(
/// The command to use to parse the command line input.
/// A command line string to parse, which can include spaces and quotes equivalent to what can be entered into a terminal.
/// A parse result describing the outcome of the parse operation.
+ /// Command-line syntax overview
public static ParseResult Parse(
this Command command,
string commandLine) =>
diff --git a/src/System.CommandLine/CommandLineConfiguration.cs b/src/System.CommandLine/CommandLineConfiguration.cs
index 301a15d515..6d01133b2a 100644
--- a/src/System.CommandLine/CommandLineConfiguration.cs
+++ b/src/System.CommandLine/CommandLineConfiguration.cs
@@ -65,11 +65,13 @@ internal static HelpBuilder DefaultHelpBuilderFactory(BindingContext context, in
///
/// Gets whether directives are enabled.
///
+ /// Command-line syntax overview - Directives
public bool EnableDirectives { get; }
///
/// Enables the legacy behavior of the -- token, which is to ignore parsing of subsequent tokens and place them in the list.
///
+ /// Command-line syntax overview
public bool EnableLegacyDoubleDashBehavior { get; }
///
diff --git a/src/System.CommandLine/CompletionSourceExtensions.cs b/src/System.CommandLine/CompletionSourceExtensions.cs
index 73263d0d86..8037cc2da7 100644
--- a/src/System.CommandLine/CompletionSourceExtensions.cs
+++ b/src/System.CommandLine/CompletionSourceExtensions.cs
@@ -10,6 +10,7 @@ namespace System.CommandLine
///
/// Provides extension methods for working with completion sources.
///
+ /// Tab completion
public static class CompletionSourceExtensions
{
///
@@ -17,6 +18,7 @@ public static class CompletionSourceExtensions
///
/// The list of completion sources to add to.
/// The delegate to be called when calculating completions.
+ /// Tab completion
public static void Add(
this CompletionSourceList completionSources,
Func> complete)
@@ -39,7 +41,8 @@ public static void Add(
///
/// The list of completion sources to add to.
/// The delegate to be called when calculating completions.
- public static void Add(
+ /// Tab completion
+ public static void Add(
this CompletionSourceList completionSources,
CompletionDelegate complete)
{
@@ -61,6 +64,7 @@ public static void Add(
///
/// The list of completion sources to add to.
/// A list of strings to be suggested for command line completions.
+ /// Tab completion
public static void Add(
this CompletionSourceList completionSources,
params string[] completions)
diff --git a/src/System.CommandLine/CompletionSourceList.cs b/src/System.CommandLine/CompletionSourceList.cs
index 4230c091ad..39d8ba3f00 100644
--- a/src/System.CommandLine/CompletionSourceList.cs
+++ b/src/System.CommandLine/CompletionSourceList.cs
@@ -10,6 +10,7 @@ namespace System.CommandLine
///
/// A list of completion sources to be used when providing completions for completion.
///
+ /// Tab completion
public class CompletionSourceList : IReadOnlyList
{
private readonly List _sources = new();
@@ -18,6 +19,7 @@ public class CompletionSourceList : IReadOnlyList
/// Adds a completion source to the list.
///
/// The source to add.
+ /// Tab completion
public void Add(ICompletionSource source)
{
_sources.Add(source);
diff --git a/src/System.CommandLine/Completions/CompletionContext.cs b/src/System.CommandLine/Completions/CompletionContext.cs
index 720dc33984..b60c149160 100644
--- a/src/System.CommandLine/Completions/CompletionContext.cs
+++ b/src/System.CommandLine/Completions/CompletionContext.cs
@@ -9,7 +9,8 @@ namespace System.CommandLine.Completions
///
/// Supports command line completion operations.
///
- public abstract class CompletionContext
+ /// Tab completion
+ public abstract class CompletionContext
{
internal CompletionContext(ParseResult parseResult, string wordToComplete)
{
diff --git a/src/System.CommandLine/Completions/CompletionDelegate.cs b/src/System.CommandLine/Completions/CompletionDelegate.cs
index ca5d3b499b..286bc72167 100644
--- a/src/System.CommandLine/Completions/CompletionDelegate.cs
+++ b/src/System.CommandLine/Completions/CompletionDelegate.cs
@@ -9,5 +9,6 @@ namespace System.CommandLine.Completions
/// Provides command line completion.
///
/// A list of completions.
+ /// Tab completion
public delegate IEnumerable CompletionDelegate(CompletionContext context);
}
\ No newline at end of file
diff --git a/src/System.CommandLine/Completions/CompletionItem.cs b/src/System.CommandLine/Completions/CompletionItem.cs
index bfa60b25c6..287ca3c1db 100644
--- a/src/System.CommandLine/Completions/CompletionItem.cs
+++ b/src/System.CommandLine/Completions/CompletionItem.cs
@@ -14,6 +14,7 @@ public class CompletionItem
/// The text to be inserted by this completion item. If this is not provided, then is used.
/// Documentation about the completion item.
/// Additional details regarding the completion item.
+ /// Tab completion
public CompletionItem(
string label,
string kind = CompletionItemKind.Value,
diff --git a/src/System.CommandLine/Completions/ICompletionSource.cs b/src/System.CommandLine/Completions/ICompletionSource.cs
index 621d109e4c..ac27fb29a0 100644
--- a/src/System.CommandLine/Completions/ICompletionSource.cs
+++ b/src/System.CommandLine/Completions/ICompletionSource.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine.Completions
///
/// Provides completions and example values for help.
///
+ /// Tab completion
public interface ICompletionSource
{
///
diff --git a/src/System.CommandLine/Completions/TextCompletionContext.cs b/src/System.CommandLine/Completions/TextCompletionContext.cs
index 0b0b188589..b5d9901c89 100644
--- a/src/System.CommandLine/Completions/TextCompletionContext.cs
+++ b/src/System.CommandLine/Completions/TextCompletionContext.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine.Completions;
///
/// Provides details for calculating completions in the context of complete, unsplit command line text.
///
+/// Tab completion
public class TextCompletionContext : CompletionContext
{
private TextCompletionContext(
diff --git a/src/System.CommandLine/Completions/TokenCompletionContext.cs b/src/System.CommandLine/Completions/TokenCompletionContext.cs
index 60af7c0fd6..02b8c9866c 100644
--- a/src/System.CommandLine/Completions/TokenCompletionContext.cs
+++ b/src/System.CommandLine/Completions/TokenCompletionContext.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine.Completions;
///
/// Provides details for getting completions when the complete text of the original command line is not available.
///
+/// Tab completion
public class TokenCompletionContext : CompletionContext
{
internal TokenCompletionContext(ParseResult parseResult) : base(parseResult, GetWordToComplete(parseResult))
diff --git a/src/System.CommandLine/DirectiveCollection.cs b/src/System.CommandLine/DirectiveCollection.cs
index 45a469d360..de0f8ac96b 100644
--- a/src/System.CommandLine/DirectiveCollection.cs
+++ b/src/System.CommandLine/DirectiveCollection.cs
@@ -15,6 +15,7 @@ namespace System.CommandLine
/// > myapp [directive-one] [directive-two:value] arg1 arg2
/// The second has a value specified as well, value . Directive values can be read by calling using .
///
+ /// Command-line syntax overview - Directives
public class DirectiveCollection : IEnumerable>>
{
private Dictionary>? _directives;
@@ -41,6 +42,7 @@ internal void Add(string name, string? value)
///
/// The name of the directive.
/// if a directive with the specified name was parsed; otherwise, .
+ /// Command-line syntax overview - Directives
public bool Contains(string name)
{
return _directives is not null && _directives.ContainsKey(name);
@@ -52,6 +54,7 @@ public bool Contains(string name)
/// The name of the directive.
/// The values provided for the specified directive.
/// if a directive with the specified name was parsed; otherwise, .
+ /// Command-line syntax overview - Directives
public bool TryGetValues(string name, [NotNullWhen(true)] out IReadOnlyList? values)
{
if (_directives is not null &&
diff --git a/src/System.CommandLine/Handler.Action.cs b/src/System.CommandLine/Handler.Action.cs
index f3aa9db6ed..98311916e6 100644
--- a/src/System.CommandLine/Handler.Action.cs
+++ b/src/System.CommandLine/Handler.Action.cs
@@ -9,11 +9,13 @@ namespace System.CommandLine
///
/// Provides methods for creating and working with command handlers.
///
+ /// How to bind arguments to handlers
public static partial class Handler
{
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle) =>
@@ -22,6 +24,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -39,6 +42,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -57,6 +61,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -76,6 +81,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -96,6 +102,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -117,6 +124,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -139,6 +147,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -162,6 +171,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -185,6 +195,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
+ /// How to bind arguments to handlers
///
public static void SetHandler(
this Command command,
@@ -211,6 +222,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -237,6 +249,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -264,6 +277,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -292,6 +306,7 @@ public static void SetHandler
///
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -321,6 +336,7 @@ public static void SetHandler
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -351,6 +367,7 @@ public static void SetHandler
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
@@ -382,6 +399,7 @@ public static void SetHandler
/// Sets a command's handler based on an .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Action handle,
diff --git a/src/System.CommandLine/Handler.Func.cs b/src/System.CommandLine/Handler.Func.cs
index 3fbe7bdfda..2d19f9737f 100644
--- a/src/System.CommandLine/Handler.Func.cs
+++ b/src/System.CommandLine/Handler.Func.cs
@@ -10,11 +10,13 @@ namespace System.CommandLine
///
/// Provides methods for creating and working with command handlers.
///
+ /// How to bind arguments to handlers
public static partial class Handler
{
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle) =>
@@ -23,6 +25,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -40,6 +43,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -58,6 +62,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -77,6 +82,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -97,6 +103,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -118,6 +125,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -140,6 +148,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -163,6 +172,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -187,6 +197,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -212,6 +223,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -238,6 +250,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -265,6 +278,7 @@ public static void SetHandler(
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -293,6 +307,7 @@ public static void SetHandler
///
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -322,6 +337,7 @@ public static void SetHandler
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
@@ -383,6 +399,7 @@ public static void SetHandler
/// Sets a command's handler based on a .
///
+ /// How to bind arguments to handlers
public static void SetHandler(
this Command command,
Func handle,
diff --git a/src/System.CommandLine/Help/HelpBuilder.Default.cs b/src/System.CommandLine/Help/HelpBuilder.Default.cs
index 61c32af136..5381b5fee4 100644
--- a/src/System.CommandLine/Help/HelpBuilder.Default.cs
+++ b/src/System.CommandLine/Help/HelpBuilder.Default.cs
@@ -14,6 +14,7 @@ public partial class HelpBuilder
///
/// Provides default formatting for help output.
///
+ /// Customize help
public static class Default
{
///
diff --git a/src/System.CommandLine/Help/HelpBuilder.cs b/src/System.CommandLine/Help/HelpBuilder.cs
index d4d5cd41da..9b0bcb92e5 100644
--- a/src/System.CommandLine/Help/HelpBuilder.cs
+++ b/src/System.CommandLine/Help/HelpBuilder.cs
@@ -10,6 +10,7 @@ namespace System.CommandLine.Help
///
/// Formats output to be shown to users to describe how to use a command line tool.
///
+ /// Customize help
public partial class HelpBuilder
{
private const string Indent = " ";
diff --git a/src/System.CommandLine/Help/HelpBuilderExtensions.cs b/src/System.CommandLine/Help/HelpBuilderExtensions.cs
index 9d7a5272a6..8dac60810e 100644
--- a/src/System.CommandLine/Help/HelpBuilderExtensions.cs
+++ b/src/System.CommandLine/Help/HelpBuilderExtensions.cs
@@ -18,6 +18,7 @@ public static class HelpBuilderExtensions
/// A delegate to display the first help column (typically name and usage information).
/// A delegate to display second help column (typically the description).
/// The displayed default value for the symbol.
+ /// Customize help
public static void CustomizeSymbol(
this HelpBuilder builder,
Symbol symbol,
diff --git a/src/System.CommandLine/Help/HelpContext.cs b/src/System.CommandLine/Help/HelpContext.cs
index 32142eb2f9..bfd88e4cba 100644
--- a/src/System.CommandLine/Help/HelpContext.cs
+++ b/src/System.CommandLine/Help/HelpContext.cs
@@ -15,6 +15,7 @@ public class HelpContext
/// The command for which help is being formatted.
/// A text writer to write output to.
/// The result of the current parse operation.
+ /// Customize help
public HelpContext(
HelpBuilder helpBuilder,
Command command,
diff --git a/src/System.CommandLine/Help/HelpSectionDelegate.cs b/src/System.CommandLine/Help/HelpSectionDelegate.cs
index e69a417925..116e6b6839 100644
--- a/src/System.CommandLine/Help/HelpSectionDelegate.cs
+++ b/src/System.CommandLine/Help/HelpSectionDelegate.cs
@@ -7,5 +7,6 @@ namespace System.CommandLine.Help
/// Specifies help formatting behavior for a section of command line help.
///
/// if anything was written; otherwise, .
+ /// Customize help
public delegate void HelpSectionDelegate(HelpContext context);
}
\ No newline at end of file
diff --git a/src/System.CommandLine/Help/TwoColumnHelpRow.cs b/src/System.CommandLine/Help/TwoColumnHelpRow.cs
index 361b0e7af9..0c97f7c317 100644
--- a/src/System.CommandLine/Help/TwoColumnHelpRow.cs
+++ b/src/System.CommandLine/Help/TwoColumnHelpRow.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine.Help
///
/// Provides details about an item to be formatted to output in order to display two-column command line help.
///
+ /// Customize help
public class TwoColumnHelpRow : IEquatable
{
/// The name and invocation details, typically displayed in the first help column.
diff --git a/src/System.CommandLine/IdentifierSymbol.cs b/src/System.CommandLine/IdentifierSymbol.cs
index 92b49598a2..d7881f28ed 100644
--- a/src/System.CommandLine/IdentifierSymbol.cs
+++ b/src/System.CommandLine/IdentifierSymbol.cs
@@ -9,6 +9,7 @@ namespace System.CommandLine
///
/// A symbol, such as an option or command, having one or more fixed names in a command line interface.
///
+ /// How to define commands, options, and arguments
public abstract class IdentifierSymbol : Symbol
{
private protected readonly HashSet _aliases = new(StringComparer.Ordinal);
@@ -28,6 +29,7 @@ protected IdentifierSymbol(string? description = null)
///
/// The name of the symbol.
/// The description of the symbol, which is displayed in command line help.
+ /// How to define commands, options, and arguments
protected IdentifierSymbol(string name, string? description = null)
{
Name = name;
@@ -60,9 +62,11 @@ public override string Name
}
///
- /// Adds an alias. Multiple aliases can be added, most often used to provide a shorthand alternative.
+ /// Adds an alias .
///
/// The alias to add.
+ /// Multiple aliases can be added.
+ /// How to define commands, options, and arguments
public void AddAlias(string alias)
{
ThrowIfAliasIsInvalid(alias);
@@ -73,7 +77,7 @@ public void AddAlias(string alias)
private protected virtual void RemoveAlias(string alias) => _aliases.Remove(alias);
///
- /// Determines whether the alias has already been defined.
+ /// Determines whether the alias has already been defined.
///
/// The alias to search for.
/// true if the alias has already been defined; otherwise false .
diff --git a/src/System.CommandLine/Invocation/ICommandHandler.cs b/src/System.CommandLine/Invocation/ICommandHandler.cs
index 018dbe9b56..8e047978af 100644
--- a/src/System.CommandLine/Invocation/ICommandHandler.cs
+++ b/src/System.CommandLine/Invocation/ICommandHandler.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine.Invocation
///
/// Defines the behavior of a command.
///
+ /// How to bind arguments to handlers
public interface ICommandHandler
{
///
diff --git a/src/System.CommandLine/Invocation/IInvocationResult.cs b/src/System.CommandLine/Invocation/IInvocationResult.cs
index 0432163491..aa9a236932 100644
--- a/src/System.CommandLine/Invocation/IInvocationResult.cs
+++ b/src/System.CommandLine/Invocation/IInvocationResult.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Invocation
///
/// The result of a command handler invocation.
///
+ /// How to bind arguments to handlers
public interface IInvocationResult
{
///
diff --git a/src/System.CommandLine/Invocation/InvocationContext.cs b/src/System.CommandLine/Invocation/InvocationContext.cs
index 5a14abef22..bb2f231486 100644
--- a/src/System.CommandLine/Invocation/InvocationContext.cs
+++ b/src/System.CommandLine/Invocation/InvocationContext.cs
@@ -12,6 +12,7 @@ namespace System.CommandLine.Invocation
///
/// Supports command invocation by providing access to parse results and other services.
///
+ /// How to bind arguments to handlers
public sealed class InvocationContext
{
private CancellationTokenSource? _cts;
diff --git a/src/System.CommandLine/Invocation/InvocationMiddleware.cs b/src/System.CommandLine/Invocation/InvocationMiddleware.cs
index 7ae994427f..20d244bc83 100644
--- a/src/System.CommandLine/Invocation/InvocationMiddleware.cs
+++ b/src/System.CommandLine/Invocation/InvocationMiddleware.cs
@@ -10,6 +10,7 @@ namespace System.CommandLine.Invocation
///
/// The context for the current invocation, which will be passed to each middleware and then to the command handler, unless a middleware short circuits it.
/// A continuation. Passing the incoming to it will execute the next middleware in the pipeline and, at the end of the pipeline, the command handler. Middleware can short circuit the invocation by not calling this continuation.
+ /// How to use middleware
public delegate Task InvocationMiddleware(
InvocationContext context,
Func next);
diff --git a/src/System.CommandLine/Invocation/MiddlewareOrder.cs b/src/System.CommandLine/Invocation/MiddlewareOrder.cs
index 411d887ae7..96ceba436b 100644
--- a/src/System.CommandLine/Invocation/MiddlewareOrder.cs
+++ b/src/System.CommandLine/Invocation/MiddlewareOrder.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Invocation
///
/// Designates ordering of middleware in the invocation pipeline.
///
+ /// How to use middleware
public enum MiddlewareOrder
{
///
diff --git a/src/System.CommandLine/Option.cs b/src/System.CommandLine/Option.cs
index 9f17f0242f..3e766d8440 100644
--- a/src/System.CommandLine/Option.cs
+++ b/src/System.CommandLine/Option.cs
@@ -13,6 +13,7 @@ namespace System.CommandLine
/// A symbol defining a named parameter and a value for that parameter.
///
///
+ /// How to define commands, options, and arguments
public abstract class Option : IdentifierSymbol, IValueDescriptor
{
private string? _name;
@@ -66,6 +67,7 @@ internal Option(
///
/// Gets the argument for the option.
///
+ /// How to define commands, options, and arguments
internal virtual Argument Argument => _argument;
///
@@ -74,6 +76,7 @@ internal Option(
///
/// The name of the argument when displayed in help.
///
+ /// How to customize help
public string? ArgumentHelpName
{
get => Argument.HelpName;
@@ -81,8 +84,9 @@ public string? ArgumentHelpName
}
///
- /// Gets or sets the arity of the option.
+ /// Gets or sets the arity of the option.
///
+ /// How to define commands, options, and arguments
public virtual ArgumentArity Arity
{
get => Argument.Arity;
@@ -93,6 +97,8 @@ public virtual ArgumentArity Arity
/// Global options are applied to the command and recursively to subcommands.
/// They do not apply to parent commands.
///
+ /// How to define commands, options, and arguments
+ /// Tutorial: Get started with System.CommandLine
internal bool IsGlobal { get; set; }
internal bool DisallowBinding { get; init; }
@@ -120,6 +126,7 @@ public override string Name
/// Adds a validator that will be called when the option is matched by the parser.
///
/// A delegate used to validate the produced during parsing.
+ /// How to bind arguments to handlers - Custom validation and binding
public void AddValidator(ValidateSymbolResult validate) => Validators.Add(validate);
///
@@ -127,6 +134,7 @@ public override string Name
///
/// The alias, which can include a prefix.
/// if the alias exists; otherwise, .
+ /// Command-line syntax overview - Aliases
public bool HasAliasIgnoringPrefix(string alias)
{
ReadOnlySpan rawAlias = alias.AsSpan(alias.GetPrefixLength());
@@ -146,6 +154,7 @@ public bool HasAliasIgnoringPrefix(string alias)
/// Sets the default value for the option.
///
/// The default value for the option.
+ /// How to define commands, options, and arguments
public void SetDefaultValue(object? value) =>
Argument.SetDefaultValue(value);
@@ -154,6 +163,7 @@ public void SetDefaultValue(object? value) =>
///
/// The delegate to invoke to return the default value.
/// Thrown when is null.
+ /// How to define commands, options, and arguments
public void SetDefaultValueFactory(Func getDefaultValue) =>
Argument.SetDefaultValueFactory(getDefaultValue);
@@ -170,6 +180,7 @@ public void SetDefaultValueFactory(Func getDefaultValue) =>
/// > --opt 1 --opt 2 --opt 3
///
///
+ /// How to define commands, options, and arguments - Multiple arguments
public bool AllowMultipleArgumentsPerToken { get; set; }
internal virtual bool IsGreedy
@@ -179,13 +190,16 @@ internal virtual bool IsGreedy
/// Indicates whether the option is required when its parent command is invoked.
///
/// When an option is required and its parent command is invoked without it, an error results.
+ /// How to define commands, options, and arguments - Required options
public bool IsRequired { get; set; }
+
string IValueDescriptor.ValueName => Name;
///
/// The that the option's arguments are expected to be parsed as.
///
+ /// How to define commands, options, and arguments
public Type ValueType => Argument.ValueType;
bool IValueDescriptor.HasDefaultValue => Argument.HasDefaultValue;
diff --git a/src/System.CommandLine/OptionExtensions.cs b/src/System.CommandLine/OptionExtensions.cs
index 58e594a00c..9905289419 100644
--- a/src/System.CommandLine/OptionExtensions.cs
+++ b/src/System.CommandLine/OptionExtensions.cs
@@ -12,6 +12,7 @@ namespace System.CommandLine
///
/// Provides extension methods for .
///
+ /// How to define commands, options, and arguments
public static class OptionExtensions
{
///
@@ -21,6 +22,7 @@ public static class OptionExtensions
/// The values that are allowed for the option.
/// The type of the option's parsed value.
/// The configured argument.
+ /// How to define commands, options, and arguments - List valid argument values
public static TOption FromAmong(
this TOption option,
params string[] values)
@@ -39,6 +41,7 @@ public static TOption FromAmong(
/// The option for which to add completions.
/// The completions to add.
/// The option being extended.
+ /// Tab completion
public static TOption AddCompletions(
this TOption option,
params string[] values)
@@ -56,6 +59,7 @@ public static TOption AddCompletions(
/// The option for which to add completions.
/// A that will be called to provide completions.
/// The option being extended.
+ /// Tab completion
public static TOption AddCompletions(
this TOption option,
Func> complete)
@@ -73,6 +77,7 @@ public static TOption AddCompletions(
/// The option for which to add completions.
/// A that will be called to provide completions.
/// The option being extended.
+ /// Tab completion
public static TOption AddCompletions(
this TOption option,
CompletionDelegate complete)
@@ -88,6 +93,7 @@ public static TOption AddCompletions(
///
/// The option to configure.
/// The option being extended.
+ /// How to bind arguments to handlers
public static Option ExistingOnly(this Option option)
{
option.Argument.AddValidator(Validate.FileExists);
@@ -99,6 +105,7 @@ public static Option ExistingOnly(this Option option)
///
/// The option to configure.
/// The option being extended.
+ /// How to bind arguments to handlers
public static Option ExistingOnly(this Option option)
{
option.Argument.AddValidator(Validate.DirectoryExists);
@@ -110,6 +117,7 @@ public static Option ExistingOnly(this Option opti
///
/// The option to configure.
/// The option being extended.
+ /// How to bind arguments to handlers
public static Option ExistingOnly(this Option option)
{
option.Argument.AddValidator(Validate.FileOrDirectoryExists);
@@ -117,10 +125,11 @@ public static Option ExistingOnly(this Option op
}
///
- /// Configures an option to accept only values corresponding to a existing files or directories.
+ /// Configures an option to accept only values corresponding to existing files or directories.
///
/// The option to configure.
/// The option being extended.
+ /// How to bind arguments to handlers
public static Option ExistingOnly(this Option option)
where T : IEnumerable
{
@@ -137,6 +146,7 @@ public static Option ExistingOnly(this Option option)
///
/// The option to configure.
/// The option being extended.
+ /// How to bind arguments to handlers
public static TOption LegalFilePathsOnly(
this TOption option)
where TOption : Option
@@ -152,6 +162,7 @@ public static TOption LegalFilePathsOnly(
/// A parse error will result, for example, if file path separators are found in the parsed value.
/// The option to configure.
/// The option being extended.
+ /// How to bind arguments to handlers
public static TOption LegalFileNamesOnly(
this TOption option)
where TOption : Option
@@ -168,6 +179,7 @@ public static TOption LegalFileNamesOnly(
/// The option to use to parse the command line input.
/// A command line string to parse, which can include spaces and quotes equivalent to what can be entered into a terminal.
/// A parse result describing the outcome of the parse operation.
+ /// Command-line syntax overview
public static ParseResult Parse(
this Option option,
string commandLine) =>
@@ -179,6 +191,7 @@ public static ParseResult Parse(
/// The option to use to parse the command line input.
/// The string options to parse.
/// A parse result describing the outcome of the parse operation.
+ /// Command-line syntax overview
public static ParseResult Parse(
this Option option,
string[] args) =>
diff --git a/src/System.CommandLine/Option{T}.cs b/src/System.CommandLine/Option{T}.cs
index 5b049a42f0..fe24e7cff2 100644
--- a/src/System.CommandLine/Option{T}.cs
+++ b/src/System.CommandLine/Option{T}.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine
{
///
/// The that the option's arguments are expected to be parsed as.
+ /// How to define commands, options, and arguments
public class Option : Option, IValueDescriptor
{
///
diff --git a/src/System.CommandLine/Parsing/ArgumentResult.cs b/src/System.CommandLine/Parsing/ArgumentResult.cs
index 69e4cb18b2..e39c918614 100644
--- a/src/System.CommandLine/Parsing/ArgumentResult.cs
+++ b/src/System.CommandLine/Parsing/ArgumentResult.cs
@@ -10,6 +10,7 @@ namespace System.CommandLine.Parsing
///
/// A result produced when parsing an .
///
+ /// Command-line syntax overview
public class ArgumentResult : SymbolResult
{
private ArgumentConversionResult? _conversionResult;
diff --git a/src/System.CommandLine/Parsing/CommandLineStringSplitter.cs b/src/System.CommandLine/Parsing/CommandLineStringSplitter.cs
index 790cb8d370..6316f5e051 100644
--- a/src/System.CommandLine/Parsing/CommandLineStringSplitter.cs
+++ b/src/System.CommandLine/Parsing/CommandLineStringSplitter.cs
@@ -8,6 +8,7 @@ namespace System.CommandLine.Parsing
///
/// Splits a string based on whitespace and quotation marks
///
+ /// Command-line syntax overview
public class CommandLineStringSplitter
{
///
diff --git a/src/System.CommandLine/Parsing/CommandResult.cs b/src/System.CommandLine/Parsing/CommandResult.cs
index b6a9140685..2ec87661ec 100644
--- a/src/System.CommandLine/Parsing/CommandResult.cs
+++ b/src/System.CommandLine/Parsing/CommandResult.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Parsing
///
/// A result produced when parsing a .
///
+ /// Command-line syntax overview
public class CommandResult : SymbolResult
{
internal CommandResult(
diff --git a/src/System.CommandLine/Parsing/OptionResult.cs b/src/System.CommandLine/Parsing/OptionResult.cs
index e1c2b957d0..e670673893 100644
--- a/src/System.CommandLine/Parsing/OptionResult.cs
+++ b/src/System.CommandLine/Parsing/OptionResult.cs
@@ -9,6 +9,7 @@ namespace System.CommandLine.Parsing
///
/// A result produced when parsing an .
///
+ /// Command-line syntax overview
public class OptionResult : SymbolResult
{
private ArgumentConversionResult? _argumentConversionResult;
diff --git a/src/System.CommandLine/Parsing/ParseArgument{T}.cs b/src/System.CommandLine/Parsing/ParseArgument{T}.cs
index 6c434e0212..507b1fe918 100644
--- a/src/System.CommandLine/Parsing/ParseArgument{T}.cs
+++ b/src/System.CommandLine/Parsing/ParseArgument{T}.cs
@@ -10,5 +10,6 @@ namespace System.CommandLine.Parsing
/// The argument result.
/// The parsed value.
/// Validation errors can be returned by setting .
+ /// Custom validation and binding
public delegate T ParseArgument(ArgumentResult result);
}
\ No newline at end of file
diff --git a/src/System.CommandLine/Parsing/ParseError.cs b/src/System.CommandLine/Parsing/ParseError.cs
index 0ef389900b..e0bc0d95c2 100644
--- a/src/System.CommandLine/Parsing/ParseError.cs
+++ b/src/System.CommandLine/Parsing/ParseError.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Parsing
///
/// Describes an error that occurs while parsing command line input.
///
+ /// Command-line syntax overview
public class ParseError
{
internal ParseError(
diff --git a/src/System.CommandLine/Parsing/ParseResult.cs b/src/System.CommandLine/Parsing/ParseResult.cs
index de226f453d..fc4bbd133a 100644
--- a/src/System.CommandLine/Parsing/ParseResult.cs
+++ b/src/System.CommandLine/Parsing/ParseResult.cs
@@ -12,6 +12,7 @@ namespace System.CommandLine.Parsing
///
/// Describes the results of parsing a command line input based on a specific parser configuration.
///
+ /// Command-line syntax overview
public class ParseResult
{
private readonly List _errors;
diff --git a/src/System.CommandLine/Parsing/ParseResultExtensions.cs b/src/System.CommandLine/Parsing/ParseResultExtensions.cs
index 0f233fe4f7..2602d90c64 100644
--- a/src/System.CommandLine/Parsing/ParseResultExtensions.cs
+++ b/src/System.CommandLine/Parsing/ParseResultExtensions.cs
@@ -21,6 +21,7 @@ public static class ParseResultExtensions
/// A parse result on which the invocation is based.
/// A console to which output can be written. By default, is used.
/// A task whose result can be used as a process exit code.
+ /// How to bind arguments to handlers
public static async Task InvokeAsync(
this ParseResult parseResult,
IConsole? console = null) =>
@@ -32,6 +33,7 @@ public static async Task InvokeAsync(
/// A parse result on which the invocation is based.
/// A console to which output can be written. By default, is used.
/// A value that can be used as a process exit code.
+ /// How to bind arguments to handlers
public static int Invoke(
this ParseResult parseResult,
IConsole? console = null) =>
@@ -42,6 +44,7 @@ public static int Invoke(
///
/// The parse result to be diagrammed.
/// A string containing a diagram of the parse result.
+ /// Command-line syntax overview
public static string Diagram(this ParseResult parseResult)
{
var builder = StringBuilderPool.Default.Rent();
@@ -183,6 +186,7 @@ private static void Diagram(
/// The parse result to check for the presence of the option.
/// The option to check for the presence of.
/// if the option is present; otherwise, .
+ /// Command-line syntax overview
public static bool HasOption(
this ParseResult parseResult,
Option option)
diff --git a/src/System.CommandLine/Parsing/Parser.cs b/src/System.CommandLine/Parsing/Parser.cs
index 72f5e61d19..be560ed181 100644
--- a/src/System.CommandLine/Parsing/Parser.cs
+++ b/src/System.CommandLine/Parsing/Parser.cs
@@ -40,6 +40,7 @@ public Parser() : this(new RootCommand())
/// The string array typically passed to a program's Main method.
/// Holds the value of a complete command line input prior to splitting and tokenization, when provided. This will typically not be available when the parser is called from Program.Main . It is primarily used when calculating completions via the dotnet-suggest tool.
/// A providing details about the parse operation.
+ /// Command-line syntax overview
public ParseResult Parse(
IReadOnlyList arguments,
string? rawInput = null)
diff --git a/src/System.CommandLine/Parsing/ParserExtensions.cs b/src/System.CommandLine/Parsing/ParserExtensions.cs
index 0f51f66ec7..76c1e149d4 100644
--- a/src/System.CommandLine/Parsing/ParserExtensions.cs
+++ b/src/System.CommandLine/Parsing/ParserExtensions.cs
@@ -16,6 +16,7 @@ public static class ParserExtensions
///
/// The exit code for the invocation.
/// The command line string input will be split into tokens as if it had been passed on the command line.
+ /// How to bind arguments to handlers
public static int Invoke(
this Parser parser,
string commandLine,
@@ -26,6 +27,7 @@ public static int Invoke(
/// Parses a command line string array and invokes the handler for the indicated command.
///
/// The exit code for the invocation.
+ /// How to bind arguments to handlers
public static int Invoke(
this Parser parser,
string[] args,
@@ -37,6 +39,7 @@ public static int Invoke(
///
/// The exit code for the invocation.
/// The command line string input will be split into tokens as if it had been passed on the command line.
+ /// How to bind arguments to handlers
public static Task InvokeAsync(
this Parser parser,
string commandLine,
@@ -47,6 +50,7 @@ public static Task InvokeAsync(
/// Parses a command line string array and invokes the handler for the indicated command.
///
/// The exit code for the invocation.
+ /// How to bind arguments to handlers
public static async Task InvokeAsync(
this Parser parser,
string[] args,
@@ -57,6 +61,7 @@ public static async Task InvokeAsync(
/// Parses a command line string.
///
/// The command line string input will be split into tokens as if it had been passed on the command line.
+ /// Command-line syntax overview
public static ParseResult Parse(
this Parser parser,
string commandLine)
diff --git a/src/System.CommandLine/Parsing/ResponseFileHandling.cs b/src/System.CommandLine/Parsing/ResponseFileHandling.cs
index daa64d1c28..7e7d64ee76 100644
--- a/src/System.CommandLine/Parsing/ResponseFileHandling.cs
+++ b/src/System.CommandLine/Parsing/ResponseFileHandling.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Parsing
///
/// Specifies settings for response file parsing.
///
+ /// Command-line syntax overview
public enum ResponseFileHandling
{
diff --git a/src/System.CommandLine/Parsing/Token.cs b/src/System.CommandLine/Parsing/Token.cs
index 7b656c9886..ec3c02114e 100644
--- a/src/System.CommandLine/Parsing/Token.cs
+++ b/src/System.CommandLine/Parsing/Token.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Parsing
///
/// A unit of significant text on the command line.
///
+ /// Tokens
public class Token : IEquatable
{
internal const int ImplicitPosition = -1;
@@ -13,6 +14,7 @@ public class Token : IEquatable
/// The string value of the token.
/// The type of the token.
/// The symbol represented by the token
+ /// Tokens
public Token(string? value, TokenType type, Symbol symbol)
{
Value = value ?? "";
diff --git a/src/System.CommandLine/Parsing/TokenType.cs b/src/System.CommandLine/Parsing/TokenType.cs
index 1bb632fb31..8c0010a969 100644
--- a/src/System.CommandLine/Parsing/TokenType.cs
+++ b/src/System.CommandLine/Parsing/TokenType.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Parsing
///
/// Identifies the type of a .
///
+ /// Command-line syntax overview
public enum TokenType
{
///
diff --git a/src/System.CommandLine/Parsing/TokenizeError.cs b/src/System.CommandLine/Parsing/TokenizeError.cs
index 6af650c20d..8ee7947b48 100644
--- a/src/System.CommandLine/Parsing/TokenizeError.cs
+++ b/src/System.CommandLine/Parsing/TokenizeError.cs
@@ -6,6 +6,7 @@ namespace System.CommandLine.Parsing
///
/// Describes an error that occurs while tokenizing command line input.
///
+ /// Command-line syntax overview
public class TokenizeError
{
internal TokenizeError(string message)
diff --git a/src/System.CommandLine/Parsing/ValidateSymbolResult.cs b/src/System.CommandLine/Parsing/ValidateSymbolResult.cs
index a0cabfea1e..08831ebfaa 100644
--- a/src/System.CommandLine/Parsing/ValidateSymbolResult.cs
+++ b/src/System.CommandLine/Parsing/ValidateSymbolResult.cs
@@ -9,5 +9,6 @@ namespace System.CommandLine.Parsing;
/// The type of the .
/// The symbol result
/// To display an error, set .
+/// How to bind arguments to handlers
public delegate void ValidateSymbolResult(T symbolResult)
where T : SymbolResult;
\ No newline at end of file
diff --git a/src/System.CommandLine/RootCommand.cs b/src/System.CommandLine/RootCommand.cs
index 3fe653c1cc..e389ed9eb8 100644
--- a/src/System.CommandLine/RootCommand.cs
+++ b/src/System.CommandLine/RootCommand.cs
@@ -14,6 +14,7 @@ namespace System.CommandLine
/// to the root for applications that require actions identified by specific strings. For example, `dir` does not
/// use any subcommands. See for applications with multiple actions.
///
+ /// How to define commands, options, and arguments
public class RootCommand : Command
{
private static Assembly? _assembly;
diff --git a/src/System.CommandLine/Symbol.cs b/src/System.CommandLine/Symbol.cs
index 5e4ccd085e..7cbaaeca06 100644
--- a/src/System.CommandLine/Symbol.cs
+++ b/src/System.CommandLine/Symbol.cs
@@ -9,6 +9,7 @@ namespace System.CommandLine
///
/// Defines a named symbol that resides in a hierarchy with parent and child symbols.
///
+ /// How to define commands, options, and arguments
public abstract class Symbol : ICompletionSource
{
private string? _name;
@@ -21,11 +22,13 @@ private protected Symbol()
///
/// Gets or sets the description of the symbol.
///
+ /// How to define commands, options, and arguments
public virtual string? Description { get; set; }
///
/// Gets or sets the name of the symbol.
///
+ /// How to define commands, options, and arguments
public virtual string Name
{
get => _name ??= DefaultName;
@@ -59,6 +62,7 @@ internal void AddParent(Symbol symbol)
///
/// Gets or sets a value indicating whether the symbol is hidden.
///
+ /// How to define commands, options, and arguments
public bool IsHidden { get; set; }
///
@@ -80,6 +84,7 @@ public IEnumerable Parents
///
/// Gets completions for the symbol.
///
+ /// Tab completion
public IEnumerable GetCompletions() =>
GetCompletions(CompletionContext.Empty());