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 /// <summary> /// A symbol defining a value that can be passed on the command line to a <see cref="Command">command</see> or <see cref="Option">option</see>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public abstract class Argument : Symbol, IValueDescriptor { private Func<ArgumentResult, object?>? _defaultValueFactory; @@ -23,6 +25,7 @@ public abstract class Argument : Symbol, IValueDescriptor /// <summary> /// Initializes a new instance of the Argument class. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> protected Argument() { } @@ -32,6 +35,7 @@ protected Argument() /// </summary> /// <param name="name">The name of the argument.</param> /// <param name="description">The description of the argument, shown in help.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> protected Argument(string? name = null, string? description = null) { Name = name!; @@ -41,8 +45,9 @@ protected Argument(string? name = null, string? description = null) internal HashSet<string>? AllowedValues { get; private set; } /// <summary> - /// Gets or sets the arity of the argument. + /// Gets or sets the <see href="/dotnet/standard/commandline/syntax#argument-arity">arity</see> of the argument. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public ArgumentArity Arity { get @@ -63,6 +68,7 @@ public ArgumentArity Arity /// <summary> /// The name used in help output to describe the argument. /// </summary> + /// <seealso href="/dotnet/standard/commandline/customize-help">How to customize help</seealso> public string? HelpName { get; set; } internal TryConvertArgument? ConvertArguments @@ -83,6 +89,7 @@ internal TryConvertArgument? ConvertArguments /// <summary> /// Gets or sets the <see cref="Type" /> that the argument token(s) will be converted to. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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. /// </summary> /// <param name="validate">The delegate to validate the parsed argument.</param> + /// <seealso href="/dotnet/standard/commandline/model-binding#custom-validation-and-binding">How to bind arguments to handlers - Custom validation and binding</seealso> public void AddValidator(ValidateSymbolResult<ArgumentResult> validate) => Validators.Add(validate); /// <summary> /// Gets the default value for the argument. /// </summary> /// <returns>Returns the default value for the argument, if defined. Null otherwise.</returns> - public object? GetDefaultValue() + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> + 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. /// </summary> /// <param name="value">The default value for the argument.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void SetDefaultValue(object? value) { SetDefaultValueFactory(() => value); @@ -146,6 +156,7 @@ public void SetDefaultValue(object? value) /// </summary> /// <param name="getDefaultValue">The delegate to invoke to return the default value.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="getDefaultValue"/> is null.</exception> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void SetDefaultValueFactory(Func<object?> getDefaultValue) { if (getDefaultValue is null) @@ -161,6 +172,7 @@ public void SetDefaultValueFactory(Func<object?> getDefaultValue) /// </summary> /// <param name="getDefaultValue">The delegate to invoke to return the default value.</param> /// <remarks>In this overload, the <see cref="ArgumentResult"/> is provided to the delegate.</remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void SetDefaultValueFactory(Func<ArgumentResult, object?> getDefaultValue) { _defaultValueFactory = getDefaultValue ?? throw new ArgumentNullException(nameof(getDefaultValue)); @@ -169,6 +181,7 @@ public void SetDefaultValueFactory(Func<ArgumentResult, object?> getDefaultValue /// <summary> /// Specifies if a default value is defined for the argument. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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 { /// <summary> - /// Defines the arity of an option or argument. + /// Defines the <see href="/dotnet/standard/commandline/syntax#argument-arity">arity</see> of an option or argument. /// </summary> /// <remarks>The arity refers to the number of values that can be passed on the command line. /// </remarks> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> [DebuggerDisplay("\\{{" + nameof(MinimumNumberOfValues) + "},{" + nameof(MaximumNumberOfValues) + "}\\}")] public readonly struct ArgumentArity : IEquatable<ArgumentArity> { @@ -25,6 +26,7 @@ namespace System.CommandLine /// <param name="maximumNumberOfValues">The maximum number of values allowed for the argument.</param> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="minimumNumberOfValues"/> is negative.</exception> /// <exception cref="ArgumentException">Thrown when the maximum number is less than the minimum number or the maximum number is greater than MaximumArity.</exception> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public ArgumentArity(int minimumNumberOfValues, int maximumNumberOfValues) { if (minimumNumberOfValues < 0) @@ -50,11 +52,13 @@ public ArgumentArity(int minimumNumberOfValues, int maximumNumberOfValues) /// <summary> /// Gets the minimum number of values required for an <see cref="Argument">argument</see>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public int MinimumNumberOfValues { get; } /// <summary> /// Gets the maximum number of values allowed for an <see cref="Argument">argument</see>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public int MaximumNumberOfValues { get; } internal bool IsNonDefault { get; } @@ -119,26 +123,31 @@ public override int GetHashCode() /// <summary> /// An arity that does not allow any values. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static ArgumentArity Zero => new(0, 0); /// <summary> /// An arity that may have one value, but no more than one. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static ArgumentArity ZeroOrOne => new(0, 1); /// <summary> /// An arity that must have exactly one value. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static ArgumentArity ExactlyOne => new(1, 1); /// <summary> /// An arity that may have multiple values. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static ArgumentArity ZeroOrMore => new(0, MaximumArity); /// <summary> /// An arity that must have at least one value. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// Provides extension methods for <see cref="Argument" />. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public static class ArgumentExtensions { /// <summary> @@ -20,6 +22,7 @@ public static class ArgumentExtensions /// <param name="argument">The argument for which to add completions.</param> /// <param name="values">The completions to add.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TArgument AddCompletions<TArgument>( this TArgument argument, params string[] values) @@ -37,6 +40,7 @@ public static TArgument AddCompletions<TArgument>( /// <param name="argument">The argument for which to add completions.</param> /// <param name="complete">A <see cref="CompletionDelegate"/> that will be called to provide completions.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TArgument AddCompletions<TArgument>( this TArgument argument, Func<CompletionContext, IEnumerable<string>> complete) @@ -54,6 +58,7 @@ public static TArgument AddCompletions<TArgument>( /// <param name="argument">The argument for which to add completions.</param> /// <param name="complete">A <see cref="CompletionDelegate"/> that will be called to provide completions.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TArgument AddCompletions<TArgument>( this TArgument argument, CompletionDelegate complete) @@ -71,6 +76,8 @@ public static TArgument AddCompletions<TArgument>( /// <param name="values">The values that are allowed for the argument.</param> /// <typeparam name="TArgument">The type of the argument.</typeparam> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TArgument FromAmong<TArgument>( this TArgument argument, params string[] values) @@ -87,6 +94,7 @@ public static TArgument FromAmong<TArgument>( /// </summary> /// <param name="argument">The argument to configure.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Argument<FileInfo> ExistingOnly(this Argument<FileInfo> argument) { argument.AddValidator(Validate.FileExists); @@ -98,6 +106,7 @@ public static Argument<FileInfo> ExistingOnly(this Argument<FileInfo> argument) /// </summary> /// <param name="argument">The argument to configure.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Argument<DirectoryInfo> ExistingOnly(this Argument<DirectoryInfo> argument) { argument.AddValidator(Validate.DirectoryExists); @@ -109,6 +118,7 @@ public static Argument<DirectoryInfo> ExistingOnly(this Argument<DirectoryInfo> /// </summary> /// <param name="argument">The argument to configure.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Argument<FileSystemInfo> ExistingOnly(this Argument<FileSystemInfo> argument) { argument.AddValidator(Validate.FileOrDirectoryExists); @@ -120,6 +130,7 @@ public static Argument<FileSystemInfo> ExistingOnly(this Argument<FileSystemInfo /// </summary> /// <param name="argument">The argument to configure.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Argument<T> ExistingOnly<T>(this Argument<T> argument) where T : IEnumerable<FileSystemInfo> { @@ -144,6 +155,7 @@ public static Argument<T> ExistingOnly<T>(this Argument<T> argument) /// </summary> /// <param name="argument">The argument to configure.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static TArgument LegalFilePathsOnly<TArgument>( this TArgument argument) where TArgument : Argument @@ -176,6 +188,7 @@ public static TArgument LegalFilePathsOnly<TArgument>( /// <remarks>A parse error will result, for example, if file path separators are found in the parsed value.</remarks> /// <param name="argument">The argument to configure.</param> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static TArgument LegalFileNamesOnly<TArgument>( this TArgument argument) where TArgument : Argument @@ -206,6 +219,7 @@ public static TArgument LegalFileNamesOnly<TArgument>( /// <param name="argument">The argument to use to parse the command line input.</param> /// <param name="commandLine">A command line string to parse, which can include spaces and quotes equivalent to what can be entered into a terminal.</param> /// <returns>A parse result describing the outcome of the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line syntax overview - Directives</seealso> public static ParseResult Parse( this Argument argument, string commandLine) => @@ -217,6 +231,7 @@ public static ParseResult Parse( /// <param name="argument">The argument to use to parse the command line input.</param> /// <param name="args">The string arguments to parse.</param> /// <returns>A parse result describing the outcome of the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line syntax overview - Directives</seealso> 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<T> : Argument, IValueDescriptor<T> /// <summary> /// Initializes a new instance of the Argument class. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public Argument() { } @@ -32,6 +33,7 @@ public Argument( /// <param name="getDefaultValue">The delegate to invoke to return the default value.</param> /// <param name="description">The description of the argument, shown in help.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="getDefaultValue"/> is null.</exception> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public Argument( string name, Func<T> getDefaultValue, @@ -50,6 +52,7 @@ public Argument( /// </summary> /// <param name="getDefaultValue">The delegate to invoke to return the default value.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="getDefaultValue"/> is null.</exception> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public Argument(Func<T> getDefaultValue) : this() { if (getDefaultValue is null) @@ -68,6 +71,7 @@ public Argument(Func<T> getDefaultValue) : this() /// <param name="isDefault"><see langword="true"/> to use the <paramref name="parse"/> result as default value.</param> /// <param name="description">The description of the argument, shown in help.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="parse"/> is null.</exception> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public Argument( string? name, ParseArgument<T> parse, @@ -108,6 +112,7 @@ public Argument( /// </summary> /// <param name="parse">A custom argument parser.</param> /// <param name="isDefault"><see langword="true"/> to use the <paramref name="parse"/> result as default value.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public Argument(ParseArgument<T> 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. /// </summary> /// <typeparam name="T">The type to be bound.</typeparam> +/// <seealso href="/dotnet/standard/commandline/model-binding#model-binding-more-than-16-options-and-arguments">Model binding more than 16 options and arguments</seealso> + public abstract class BinderBase<T> : IValueDescriptor<T>, IValueSource @@ -13,6 +15,7 @@ public abstract class BinderBase<T> : /// </summary> /// <param name="bindingContext"></param> /// <returns></returns> + /// <seealso href="/dotnet/standard/commandline/model-binding#model-binding-more-than-16-options-and-arguments">Model binding more than 16 options and arguments</seealso> 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 /// <summary> /// Creates object instances based on command line parser results, injected services, and other value sources. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> + 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 /// <summary> /// A value created by binding command line input. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> 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 /// <summary> /// Enables composition of command line configurations. /// </summary> + /// <seealso href="/dotnet/standard/commandline/customize-help">How to customize help</seealso> 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 /// <see cref="RootCommand"/> for simple applications that only have one action. For example, <c>dotnet run</c> /// uses <c>run</c> as the command. /// </remarks> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public class Command : IdentifierSymbol, IEnumerable<Symbol> { private List<Argument>? _arguments; @@ -30,6 +31,7 @@ public class Command : IdentifierSymbol, IEnumerable<Symbol> /// </summary> /// <param name="name">The name of the command.</param> /// <param name="description">The description of the command, shown in help.</param> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public Command(string name, string? description = null) : base(name, description) { } @@ -37,6 +39,7 @@ public Command(string name, string? description = null) : base(name, description /// <summary> /// Gets the child symbols. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public IEnumerable<Symbol> Children { get @@ -55,6 +58,7 @@ public IEnumerable<Symbol> Children /// <summary> /// Represents all of the arguments for the command. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public IReadOnlyList<Argument> Arguments => _arguments is not null ? _arguments : Array.Empty<Argument>(); internal bool HasArguments => _arguments is not null; @@ -62,11 +66,13 @@ public IEnumerable<Symbol> Children /// <summary> /// Represents all of the options for the command, including global options that have been applied to any of the command's ancestors. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public IReadOnlyList<Option> Options => _options is not null ? _options : Array.Empty<Option>(); /// <summary> /// Represents all of the subcommands for the command. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public IReadOnlyList<Command> Subcommands => _subcommands is not null ? _subcommands : Array.Empty<Command>(); internal IReadOnlyList<ValidateSymbolResult<CommandResult>> Validators @@ -78,6 +84,7 @@ internal IReadOnlyList<ValidateSymbolResult<CommandResult>> Validators /// Adds an <see cref="Argument"/> to the command. /// </summary> /// <param name="argument">The argument to add to the command.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void AddArgument(Argument argument) { argument.AddParent(this); @@ -89,6 +96,7 @@ public void AddArgument(Argument argument) /// </summary> /// <param name="command">The subcommand to add to the command.</param> /// <remarks>Commands can be nested to an arbitrary depth.</remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void AddCommand(Command command) { command.AddParent(this); @@ -99,6 +107,7 @@ public void AddCommand(Command command) /// Adds an <see cref="Option"/> to the command. /// </summary> /// <param name="option">The option to add to the command.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void AddOption(Option option) { option.AddParent(this); @@ -111,6 +120,7 @@ public void AddOption(Option option) /// <param name="option">The global option to add to the command.</param> /// <remarks>Global options are applied to the command and recursively to subcommands. They do not apply to /// parent commands.</remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void AddGlobalOption(Option option) { option.IsGlobal = true; @@ -120,12 +130,14 @@ public void AddGlobalOption(Option option) /// Adds an <see cref="Option"/> to the command. /// </summary> /// <param name="option">The option to add to the command.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void Add(Option option) => AddOption(option); /// <summary> /// Adds an <see cref="Argument"/> to the command. /// </summary> /// <param name="argument">The argument to add to the command.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void Add(Argument argument) => AddArgument(argument); /// <summary> @@ -133,6 +145,7 @@ public void AddGlobalOption(Option option) /// </summary> /// <param name="command">The subcommand to add to the command.</param> /// <remarks>Commands can be nested to an arbitrary depth.</remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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. /// </summary> /// <param name="validate">The delegate to validate the symbols during parsing.</param> + /// <seealso href="/dotnet/standard/commandline/model-binding#custom-validation-and-binding">How to bind arguments to handlers - Custom validation and binding</seealso> public void AddValidator(ValidateSymbolResult<CommandResult> validate) => (_validators ??= new()).Add(validate); /// <summary> @@ -149,6 +163,7 @@ public void AddGlobalOption(Option option) /// if set to <see langword="true"/> and an extra command or argument is provided, validation will fail. /// </summary> public bool TreatUnmatchedTokensAsErrors { get; set; } = true; + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> /// <summary> /// Gets or sets the <see cref="ICommandHandler"/> for the command. The handler represents the action @@ -158,11 +173,13 @@ public void AddGlobalOption(Option option) /// <para>Use one of the <see cref="Handler.SetHandler(Command, Action)" /> overloads to construct a handler.</para> /// <para>If the handler is not specified, parser errors will be generated for command line input that /// invokes this command.</para></remarks> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public ICommandHandler? Handler { get; set; } /// <summary> /// Represents all of the symbols for the command. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public IEnumerator<Symbol> GetEnumerator() => Children.GetEnumerator(); /// <inheritdoc /> 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 /// <param name="args">The arguments to parse.</param> /// <param name="console">The console to which output is written during invocation.</param> /// <returns>The exit code for the invocation.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static int Invoke( this Command command, string[] args, @@ -36,6 +37,7 @@ public static int Invoke( /// <param name="commandLine">The command line to parse.</param> /// <param name="console">The console to which output is written during invocation.</param> /// <returns>The exit code for the invocation.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static int Invoke( this Command command, string commandLine, @@ -49,6 +51,7 @@ public static int Invoke( /// <param name="args">The arguments to parse.</param> /// <param name="console">The console to which output is written during invocation.</param> /// <returns>The exit code for the invocation.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static async Task<int> InvokeAsync( this Command command, string[] args, @@ -65,6 +68,7 @@ public static async Task<int> InvokeAsync( /// <param name="commandLine">The command line to parse.</param> /// <param name="console">The console to which output is written during invocation.</param> /// <returns>The exit code for the invocation.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Task<int> InvokeAsync( this Command command, string commandLine, @@ -84,6 +88,7 @@ private static InvocationPipeline GetDefaultInvocationPipeline(Command command, /// <param name="command">The command to use to parse the command line input.</param> /// <param name="args">The string arguments to parse.</param> /// <returns>A parse result describing the outcome of the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static ParseResult Parse( this Command command, params string[] args) => @@ -96,6 +101,7 @@ public static ParseResult Parse( /// <param name="command">The command to use to parse the command line input.</param> /// <param name="commandLine">A command line string to parse, which can include spaces and quotes equivalent to what can be entered into a terminal.</param> /// <returns>A parse result describing the outcome of the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// Gets whether directives are enabled. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line syntax overview - Directives</seealso> public bool EnableDirectives { get; } /// <summary> /// Enables the legacy behavior of the <c>--</c> token, which is to ignore parsing of subsequent tokens and place them in the <see cref="ParseResult.UnparsedTokens"/> list. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public bool EnableLegacyDoubleDashBehavior { get; } /// <summary> 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 /// <summary> /// Provides extension methods for working with completion sources. /// </summary> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static class CompletionSourceExtensions { /// <summary> @@ -17,6 +18,7 @@ public static class CompletionSourceExtensions /// </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> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static void Add( this CompletionSourceList completionSources, Func<CompletionContext, IEnumerable<string>> complete) @@ -39,7 +41,8 @@ public static void Add( /// </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> - public static void Add( + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> + public static void Add( this CompletionSourceList completionSources, CompletionDelegate complete) { @@ -61,6 +64,7 @@ public static void Add( /// </summary> /// <param name="completionSources">The list of completion sources to add to.</param> /// <param name="completions">A list of strings to be suggested for command line completions.</param> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> 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 /// <summary> /// A list of completion sources to be used when providing completions for completion. /// </summary> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public class CompletionSourceList : IReadOnlyList<ICompletionSource> { private readonly List<ICompletionSource> _sources = new(); @@ -18,6 +19,7 @@ public class CompletionSourceList : IReadOnlyList<ICompletionSource> /// Adds a completion source to the list. /// </summary> /// <param name="source">The source to add.</param> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> 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 /// <summary> /// Supports command line completion operations. /// </summary> - public abstract class CompletionContext + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> + 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. /// </summary> /// <returns>A list of completions.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public delegate IEnumerable<CompletionItem> 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 /// <param name="insertText">The text to be inserted by this completion item. If this is not provided, then <paramref name="label"/> is used.</param> /// <param name="documentation">Documentation about the completion item.</param> /// <param name="detail">Additional details regarding the completion item.</param> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> 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 /// <summary> /// Provides completions and example values for help. /// </summary> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public interface ICompletionSource { /// <summary> 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; /// <summary> /// Provides details for calculating completions in the context of complete, unsplit command line text. /// </summary> +/// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> 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; /// <summary> /// Provides details for getting completions when the complete text of the original command line is not available. /// </summary> +/// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> 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 /// <code> > myapp [directive-one] [directive-two:value] arg1 arg2</code> /// The second has a value specified as well, <c>value</c>. Directive values can be read by calling using <see cref="TryGetValues"/>. /// </remarks> + /// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line syntax overview - Directives</seealso> public class DirectiveCollection : IEnumerable<KeyValuePair<string, IEnumerable<string>>> { private Dictionary<string, List<string>>? _directives; @@ -41,6 +42,7 @@ internal void Add(string name, string? value) /// </summary> /// <param name="name">The name of the directive.</param> /// <returns><see langword="true"/> if a directive with the specified name was parsed; otherwise, <see langword="false"/>.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line syntax overview - Directives</seealso> public bool Contains(string name) { return _directives is not null && _directives.ContainsKey(name); @@ -52,6 +54,7 @@ public bool Contains(string name) /// <param name="name">The name of the directive.</param> /// <param name="values">The values provided for the specified directive.</param> /// <returns><see langword="true"/> if a directive with the specified name was parsed; otherwise, <see langword="false"/>.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax#directives">Command-line syntax overview - Directives</seealso> public bool TryGetValues(string name, [NotNullWhen(true)] out IReadOnlyList<string>? 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 /// <summary> /// Provides methods for creating and working with command handlers. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static partial class Handler { /// <summary> /// Sets a command's handler based on an <see cref="Action"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler( this Command command, Action handle) => @@ -22,6 +24,7 @@ public static void SetHandler( /// <summary> /// Sets a command's handler based on an <see cref="Action{T}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T>( this Command command, Action<T> handle, @@ -39,6 +42,7 @@ public static void SetHandler<T>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2>( this Command command, Action<T1, T2> handle, @@ -57,6 +61,7 @@ public static void SetHandler<T1, T2>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3>( this Command command, Action<T1, T2, T3> handle, @@ -76,6 +81,7 @@ public static void SetHandler<T1, T2, T3>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4>( this Command command, Action<T1, T2, T3, T4> handle, @@ -96,6 +102,7 @@ public static void SetHandler<T1, T2, T3, T4>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5>( this Command command, Action<T1, T2, T3, T4, T5> handle, @@ -117,6 +124,7 @@ public static void SetHandler<T1, T2, T3, T4, T5>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6>( this Command command, Action<T1, T2, T3, T4, T5, T6> handle, @@ -139,6 +147,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7> handle, @@ -162,6 +171,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8> handle, @@ -185,6 +195,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9}"/>. + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> /// </summary> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>( this Command command, @@ -211,6 +222,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> handle, @@ -237,6 +249,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> handle, @@ -264,6 +277,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>( /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> handle, @@ -292,6 +306,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> handle, @@ -321,6 +336,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> handle, @@ -351,6 +367,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> handle, @@ -382,6 +399,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, /// <summary> /// Sets a command's handler based on an <see cref="Action{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>( this Command command, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> 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 /// <summary> /// Provides methods for creating and working with command handlers. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static partial class Handler { /// <summary> /// Sets a command's handler based on a <see cref="Func{Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler( this Command command, Func<Task> handle) => @@ -23,6 +25,7 @@ public static void SetHandler( /// <summary> /// Sets a command's handler based on a <see cref="Func{T,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T>( this Command command, Func<T, Task> handle, @@ -40,6 +43,7 @@ public static void SetHandler<T>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2>( this Command command, Func<T1, T2, Task> handle, @@ -58,6 +62,7 @@ public static void SetHandler<T1, T2>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3>( this Command command, Func<T1, T2, T3, Task> handle, @@ -77,6 +82,7 @@ public static void SetHandler<T1, T2, T3>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4>( this Command command, Func<T1, T2, T3, T4, Task> handle, @@ -97,6 +103,7 @@ public static void SetHandler<T1, T2, T3, T4>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5>( this Command command, Func<T1, T2, T3, T4, T5, Task> handle, @@ -118,6 +125,7 @@ public static void SetHandler<T1, T2, T3, T4, T5>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6>( this Command command, Func<T1, T2, T3, T4, T5, T6, Task> handle, @@ -140,6 +148,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, Task> handle, @@ -163,6 +172,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, Task> handle, @@ -187,6 +197,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Task> handle, @@ -212,6 +223,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Task> handle, @@ -238,6 +250,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, Task> handle, @@ -265,6 +278,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>( /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, Task> handle, @@ -293,6 +307,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, Task> handle, @@ -322,6 +337,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, Task> handle, @@ -383,6 +399,7 @@ public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, /// <summary> /// Sets a command's handler based on a <see cref="Func{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,Task}"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static void SetHandler<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>( this Command command, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, Task> 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 /// <summary> /// Provides default formatting for help output. /// </summary> + /// <seealso href="/dotnet/standard/commandline/customize-help">Customize help</seealso> public static class Default { /// <summary> 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 /// <summary> /// Formats output to be shown to users to describe how to use a command line tool. /// </summary> + /// <seealso href="/dotnet/standard/commandline/customize-help">Customize help</seealso> 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 /// <param name="firstColumnText">A delegate to display the first help column (typically name and usage information).</param> /// <param name="secondColumnText">A delegate to display second help column (typically the description).</param> /// <param name="defaultValue">The displayed default value for the symbol.</param> + /// <seealso href="/dotnet/standard/commandline/customize-help">Customize help</seealso> 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 /// <param name="command">The command for which help is being formatted.</param> /// <param name="output">A text writer to write output to.</param> /// <param name="parseResult">The result of the current parse operation.</param> + /// <seealso href="/dotnet/standard/commandline/customize-help">Customize help</seealso> 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. /// </summary> /// <returns><see langword="true"/> if anything was written; otherwise, <see langword="false"/>.</returns> + /// <seealso href="/dotnet/standard/commandline/customize-help">Customize help</seealso> 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 /// <summary> /// Provides details about an item to be formatted to output in order to display two-column command line help. /// </summary> + /// <seealso href="/dotnet/standard/commandline/customize-help">Customize help</seealso> public class TwoColumnHelpRow : IEquatable<TwoColumnHelpRow?> { /// <param name="firstColumnText">The name and invocation details, typically displayed in the first help column.</param> 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 /// <summary> /// A symbol, such as an option or command, having one or more fixed names in a command line interface. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public abstract class IdentifierSymbol : Symbol { private protected readonly HashSet<string> _aliases = new(StringComparer.Ordinal); @@ -28,6 +29,7 @@ protected IdentifierSymbol(string? description = null) /// </summary> /// <param name="name">The name of the symbol.</param> /// <param name="description">The description of the symbol, which is displayed in command line help.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> protected IdentifierSymbol(string name, string? description = null) { Name = name; @@ -60,9 +62,11 @@ public override string Name } /// <summary> - /// Adds an alias. Multiple aliases can be added, most often used to provide a shorthand alternative. + /// Adds an <see href="/dotnet/standard/commandline/syntax#aliases">alias</see>. /// </summary> /// <param name="alias">The alias to add.</param> + /// <remarks>Multiple aliases can be added.</remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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); /// <summary> - /// Determines whether the alias has already been defined. + /// Determines whether the <see href="/dotnet/standard/commandline/syntax#aliases">alias</see> has already been defined. /// </summary> /// <param name="alias">The alias to search for.</param> /// <returns><see langword="true">true</see> if the alias has already been defined; otherwise <see langkeyword="true">false</see>.</returns> 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 /// <summary> /// Defines the behavior of a command. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public interface ICommandHandler { /// <summary> 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 /// <summary> /// The result of a command handler invocation. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public interface IInvocationResult { /// <summary> 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 /// <summary> /// Supports command invocation by providing access to parse results and other services. /// </summary> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> 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 /// </summary> /// <param name="context">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.</param> /// <param name="next">A continuation. Passing the incoming <see cref="InvocationContext"/> 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.</param> + /// <seealso href="/dotnet/standard/commandline/use-middleware">How to use middleware</seealso> public delegate Task InvocationMiddleware( InvocationContext context, Func<InvocationContext, Task> 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 /// <summary> /// Designates ordering of middleware in the invocation pipeline. /// </summary> + /// <seealso href="/dotnet/standard/commandline/use-middleware">How to use middleware</seealso> public enum MiddlewareOrder { /// <summary> 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. /// </summary> /// <seealso cref="IdentifierSymbol" /> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public abstract class Option : IdentifierSymbol, IValueDescriptor { private string? _name; @@ -66,6 +67,7 @@ internal Option( /// <summary> /// Gets the <see cref="Argument">argument</see> for the option. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> internal virtual Argument Argument => _argument; /// <summary> @@ -74,6 +76,7 @@ internal Option( /// <value> /// The name of the argument when displayed in help. /// </value> + /// <seealso href="/dotnet/standard/commandline/customize-help">How to customize help</seealso> public string? ArgumentHelpName { get => Argument.HelpName; @@ -81,8 +84,9 @@ public string? ArgumentHelpName } /// <summary> - /// Gets or sets the arity of the option. + /// Gets or sets the <see href="/dotnet/standard/commandline/syntax#argument-arity">arity</see> of the option. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> + /// <seealso href="/dotnet/standard/commandline/get-started-tutorial">Tutorial: Get started with System.CommandLine</seealso> 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. /// </summary> /// <param name="validate">A <see cref="ValidateSymbolResult{OptionResult}"/> delegate used to validate the <see cref="OptionResult"/> produced during parsing.</param> + /// <seealso href="/dotnet/standard/commandline/model-binding#custom-validation-and-binding">How to bind arguments to handlers - Custom validation and binding</seealso> public void AddValidator(ValidateSymbolResult<OptionResult> validate) => Validators.Add(validate); /// <summary> @@ -127,6 +134,7 @@ public override string Name /// </summary> /// <param name="alias">The alias, which can include a prefix.</param> /// <returns><see langword="true"/> if the alias exists; otherwise, <see langword="false"/>.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax#aliases">Command-line syntax overview - Aliases</seealso> public bool HasAliasIgnoringPrefix(string alias) { ReadOnlySpan<char> rawAlias = alias.AsSpan(alias.GetPrefixLength()); @@ -146,6 +154,7 @@ public bool HasAliasIgnoringPrefix(string alias) /// Sets the default value for the option. /// </summary> /// <param name="value">The default value for the option.</param> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void SetDefaultValue(object? value) => Argument.SetDefaultValue(value); @@ -154,6 +163,7 @@ public void SetDefaultValue(object? value) => /// </summary> /// <param name="getDefaultValue">The delegate to invoke to return the default value.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="getDefaultValue"/> is null.</exception> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public void SetDefaultValueFactory(Func<object?> getDefaultValue) => Argument.SetDefaultValueFactory(getDefaultValue); @@ -170,6 +180,7 @@ public void SetDefaultValueFactory(Func<object?> getDefaultValue) => /// > --opt 1 --opt 2 --opt 3 /// </code> /// </example> + /// <seealso href="/dotnet/standard/commandline/define-commands#multiple-arguments">How to define commands, options, and arguments - Multiple arguments</seealso> 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. /// </summary> /// <remarks>When an option is required and its parent command is invoked without it, an error results.</remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands#required-options">How to define commands, options, and arguments - Required options</seealso> public bool IsRequired { get; set; } + string IValueDescriptor.ValueName => Name; /// <summary> /// The <see cref="System.Type"/> that the option's arguments are expected to be parsed as. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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 /// <summary> /// Provides extension methods for <see cref="Option" />. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public static class OptionExtensions { /// <summary> @@ -21,6 +22,7 @@ public static class OptionExtensions /// <param name="values">The values that are allowed for the option.</param> /// <typeparam name="TOption">The type of the option's parsed value.</typeparam> /// <returns>The configured argument.</returns> + /// <seealso href="/dotnet/standard/commandline/define-commands#list-valid-argument-values">How to define commands, options, and arguments - List valid argument values</seealso> public static TOption FromAmong<TOption>( this TOption option, params string[] values) @@ -39,6 +41,7 @@ public static TOption FromAmong<TOption>( /// <param name="option">The option for which to add completions.</param> /// <param name="values">The completions to add.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TOption AddCompletions<TOption>( this TOption option, params string[] values) @@ -56,6 +59,7 @@ public static TOption AddCompletions<TOption>( /// <param name="option">The option for which to add completions.</param> /// <param name="complete">A <see cref="CompletionDelegate"/> that will be called to provide completions.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TOption AddCompletions<TOption>( this TOption option, Func<CompletionContext, IEnumerable<string>> complete) @@ -73,6 +77,7 @@ public static TOption AddCompletions<TOption>( /// <param name="option">The option for which to add completions.</param> /// <param name="complete">A <see cref="CompletionDelegate"/> that will be called to provide completions.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public static TOption AddCompletions<TOption>( this TOption option, CompletionDelegate complete) @@ -88,6 +93,7 @@ public static TOption AddCompletions<TOption>( /// </summary> /// <param name="option">The option to configure.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Option<FileInfo> ExistingOnly(this Option<FileInfo> option) { option.Argument.AddValidator(Validate.FileExists); @@ -99,6 +105,7 @@ public static Option<FileInfo> ExistingOnly(this Option<FileInfo> option) /// </summary> /// <param name="option">The option to configure.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Option<DirectoryInfo> ExistingOnly(this Option<DirectoryInfo> option) { option.Argument.AddValidator(Validate.DirectoryExists); @@ -110,6 +117,7 @@ public static Option<DirectoryInfo> ExistingOnly(this Option<DirectoryInfo> opti /// </summary> /// <param name="option">The option to configure.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Option<FileSystemInfo> ExistingOnly(this Option<FileSystemInfo> option) { option.Argument.AddValidator(Validate.FileOrDirectoryExists); @@ -117,10 +125,11 @@ public static Option<FileSystemInfo> ExistingOnly(this Option<FileSystemInfo> op } /// <summary> - /// 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. /// </summary> /// <param name="option">The option to configure.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Option<T> ExistingOnly<T>(this Option<T> option) where T : IEnumerable<FileSystemInfo> { @@ -137,6 +146,7 @@ public static Option<T> ExistingOnly<T>(this Option<T> option) /// </summary> /// <param name="option">The option to configure.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static TOption LegalFilePathsOnly<TOption>( this TOption option) where TOption : Option @@ -152,6 +162,7 @@ public static TOption LegalFilePathsOnly<TOption>( /// <remarks>A parse error will result, for example, if file path separators are found in the parsed value.</remarks> /// <param name="option">The option to configure.</param> /// <returns>The option being extended.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static TOption LegalFileNamesOnly<TOption>( this TOption option) where TOption : Option @@ -168,6 +179,7 @@ public static TOption LegalFileNamesOnly<TOption>( /// <param name="option">The option to use to parse the command line input.</param> /// <param name="commandLine">A command line string to parse, which can include spaces and quotes equivalent to what can be entered into a terminal.</param> /// <returns>A parse result describing the outcome of the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static ParseResult Parse( this Option option, string commandLine) => @@ -179,6 +191,7 @@ public static ParseResult Parse( /// <param name="option">The option to use to parse the command line input.</param> /// <param name="args">The string options to parse.</param> /// <returns>A parse result describing the outcome of the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 { /// <inheritdoc cref="Option" /> /// <typeparam name="T">The <see cref="System.Type"/> that the option's arguments are expected to be parsed as.</typeparam> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public class Option<T> : Option, IValueDescriptor<T> { /// <inheritdoc/> 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 /// <summary> /// A result produced when parsing an <see cref="Argument"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// Splits a string based on whitespace and quotation marks /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public class CommandLineStringSplitter { /// <summary> 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 /// <summary> /// A result produced when parsing a <see cref="Command" />. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// A result produced when parsing an <see cref="Option" />. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <param name="result">The argument result.</param> /// <returns>The parsed value.</returns> /// <remarks>Validation errors can be returned by setting <see cref="SymbolResult.ErrorMessage"/>.</remarks> + /// <seealso href="/dotnet/standard/commandline/model-binding#custom-validation-and-binding">Custom validation and binding</seealso> public delegate T ParseArgument<out T>(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 /// <summary> /// Describes an error that occurs while parsing command line input. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// Describes the results of parsing a command line input based on a specific parser configuration. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public class ParseResult { private readonly List<ParseError> _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 /// <param name="parseResult">A parse result on which the invocation is based.</param> /// <param name="console">A console to which output can be written. By default, <see cref="System.Console"/> is used.</param> /// <returns>A task whose result can be used as a process exit code.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static async Task<int> InvokeAsync( this ParseResult parseResult, IConsole? console = null) => @@ -32,6 +33,7 @@ public static async Task<int> InvokeAsync( /// <param name="parseResult">A parse result on which the invocation is based.</param> /// <param name="console">A console to which output can be written. By default, <see cref="System.Console"/> is used.</param> /// <returns>A value that can be used as a process exit code.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static int Invoke( this ParseResult parseResult, IConsole? console = null) => @@ -42,6 +44,7 @@ public static int Invoke( /// </summary> /// <param name="parseResult">The parse result to be diagrammed.</param> /// <returns>A string containing a diagram of the parse result.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public static string Diagram(this ParseResult parseResult) { var builder = StringBuilderPool.Default.Rent(); @@ -183,6 +186,7 @@ private static void Diagram( /// <param name="parseResult">The parse result to check for the presence of the option.</param> /// <param name="option">The option to check for the presence of.</param> /// <returns><see langword="true"/> if the option is present; otherwise, <see langword="false"/>.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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()) /// <param name="arguments">The string array typically passed to a program's <c>Main</c> method.</param> /// <param name="rawInput">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 <c>Program.Main</c>. It is primarily used when calculating completions via the <c>dotnet-suggest</c> tool.</param> /// <returns>A <see cref="ParseResult"/> providing details about the parse operation.</returns> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public ParseResult Parse( IReadOnlyList<string> 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 /// </summary> /// <returns>The exit code for the invocation.</returns> /// <remarks>The command line string input will be split into tokens as if it had been passed on the command line.</remarks> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> 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. /// </summary> /// <returns>The exit code for the invocation.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static int Invoke( this Parser parser, string[] args, @@ -37,6 +39,7 @@ public static int Invoke( /// </summary> /// <returns>The exit code for the invocation.</returns> /// <remarks>The command line string input will be split into tokens as if it had been passed on the command line.</remarks> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static Task<int> InvokeAsync( this Parser parser, string commandLine, @@ -47,6 +50,7 @@ public static Task<int> InvokeAsync( /// Parses a command line string array and invokes the handler for the indicated command. /// </summary> /// <returns>The exit code for the invocation.</returns> + /// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public static async Task<int> InvokeAsync( this Parser parser, string[] args, @@ -57,6 +61,7 @@ public static async Task<int> InvokeAsync( /// Parses a command line string. /// </summary> /// <remarks>The command line string input will be split into tokens as if it had been passed on the command line.</remarks> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// Specifies settings for response file parsing. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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 /// <summary> /// A unit of significant text on the command line. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax#tokens">Tokens</seealso> public class Token : IEquatable<Token> { internal const int ImplicitPosition = -1; @@ -13,6 +14,7 @@ public class Token : IEquatable<Token> /// <param name="value">The string value of the token.</param> /// <param name="type">The type of the token.</param> /// <param name="symbol">The symbol represented by the token</param> + /// <seealso href="/dotnet/standard/commandline/syntax#tokens">Tokens</seealso> 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 /// <summary> /// Identifies the type of a <see cref="Token"/>. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> public enum TokenType { /// <summary> 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 /// <summary> /// Describes an error that occurs while tokenizing command line input. /// </summary> + /// <seealso href="/dotnet/standard/commandline/syntax">Command-line syntax overview</seealso> 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; /// <typeparam name="T">The type of the <see cref="SymbolResult"/>.</typeparam> /// <param name="symbolResult">The symbol result</param> /// <remarks>To display an error, set <see cref="SymbolResult.ErrorMessage"/>.</remarks> +/// <seealso href="/dotnet/standard/commandline/model-binding">How to bind arguments to handlers</seealso> public delegate void ValidateSymbolResult<in T>(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 <see cref="Command"/> for applications with multiple actions. /// </remarks> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> 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 /// <summary> /// Defines a named symbol that resides in a hierarchy with parent and child symbols. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public abstract class Symbol : ICompletionSource { private string? _name; @@ -21,11 +22,13 @@ private protected Symbol() /// <summary> /// Gets or sets the description of the symbol. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public virtual string? Description { get; set; } /// <summary> /// Gets or sets the name of the symbol. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public virtual string Name { get => _name ??= DefaultName; @@ -59,6 +62,7 @@ internal void AddParent(Symbol symbol) /// <summary> /// Gets or sets a value indicating whether the symbol is hidden. /// </summary> + /// <seealso href="/dotnet/standard/commandline/define-commands">How to define commands, options, and arguments</seealso> public bool IsHidden { get; set; } /// <summary> @@ -80,6 +84,7 @@ public IEnumerable<Symbol> Parents /// <summary> /// Gets completions for the symbol. /// </summary> + /// <seealso href="/dotnet/standard/commandline/tab-completion">Tab completion</seealso> public IEnumerable<CompletionItem> GetCompletions() => GetCompletions(CompletionContext.Empty());