mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Cleanup
This commit is contained in:
@@ -24,7 +24,7 @@ public class ApplicationConfiguration
|
||||
public bool IsPreviewModeAllowed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="ApplicationConfiguration"/>.
|
||||
/// Initializes an instance of <see cref="ApplicationConfiguration" />.
|
||||
/// </summary>
|
||||
public ApplicationConfiguration(
|
||||
IReadOnlyList<Type> commandTypes,
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ApplicationMetadata
|
||||
public string? Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="ApplicationMetadata"/>.
|
||||
/// Initializes an instance of <see cref="ApplicationMetadata" />.
|
||||
/// </summary>
|
||||
public ApplicationMetadata(
|
||||
string title,
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed class CommandAttribute : Attribute
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandAttribute" />.
|
||||
/// </summary>
|
||||
public CommandAttribute(string name)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ public sealed class CommandAttribute : Attribute
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandAttribute" />.
|
||||
/// </summary>
|
||||
public CommandAttribute()
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Must contain at least two characters and start with a letter.
|
||||
/// Either <see cref="Name"/> or <see cref="ShortName"/> must be set.
|
||||
/// Either <see cref="Name" /> or <see cref="ShortName" /> must be set.
|
||||
/// All options in a command must have unique names (comparison IS NOT case-sensitive).
|
||||
/// </remarks>
|
||||
public string? Name { get; }
|
||||
@@ -23,7 +23,7 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
/// Option short name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Either <see cref="Name"/> or <see cref="ShortName"/> must be set.
|
||||
/// Either <see cref="Name" /> or <see cref="ShortName" /> must be set.
|
||||
/// All options in a command must have unique short names (comparison IS case-sensitive).
|
||||
/// </remarks>
|
||||
public char? ShortName { get; }
|
||||
@@ -51,7 +51,7 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
/// a value expected by the underlying property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Converter must derive from <see cref="BindingConverter{T}"/>.
|
||||
/// Converter must derive from <see cref="BindingConverter{T}" />.
|
||||
/// </remarks>
|
||||
public Type? Converter { get; set; }
|
||||
|
||||
@@ -60,12 +60,12 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
/// property, after it has been bound.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Validators must derive from <see cref="BindingValidator{T}"/>.
|
||||
/// Validators must derive from <see cref="BindingValidator{T}" />.
|
||||
/// </remarks>
|
||||
public Type[] Validators { get; set; } = Array.Empty<Type>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute" />.
|
||||
/// </summary>
|
||||
private CommandOptionAttribute(string? name, char? shortName)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute" />.
|
||||
/// </summary>
|
||||
public CommandOptionAttribute(string name, char shortName)
|
||||
: this(name, (char?) shortName)
|
||||
@@ -82,7 +82,7 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute" />.
|
||||
/// </summary>
|
||||
public CommandOptionAttribute(string name)
|
||||
: this(name, null)
|
||||
@@ -90,7 +90,7 @@ public sealed class CommandOptionAttribute : Attribute
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandOptionAttribute" />.
|
||||
/// </summary>
|
||||
public CommandOptionAttribute(char shortName)
|
||||
: this(null, (char?) shortName)
|
||||
|
||||
@@ -51,7 +51,7 @@ public sealed class CommandParameterAttribute : Attribute
|
||||
/// a value expected by the underlying property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Converter must derive from <see cref="BindingConverter{T}"/>.
|
||||
/// Converter must derive from <see cref="BindingConverter{T}" />.
|
||||
/// </remarks>
|
||||
public Type? Converter { get; set; }
|
||||
|
||||
@@ -60,12 +60,12 @@ public sealed class CommandParameterAttribute : Attribute
|
||||
/// property, after it has been bound.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Validators must derive from <see cref="BindingValidator{T}"/>.
|
||||
/// Validators must derive from <see cref="BindingValidator{T}" />.
|
||||
/// </remarks>
|
||||
public Type[] Validators { get; set; } = Array.Empty<Type>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandParameterAttribute"/>.
|
||||
/// Initializes an instance of <see cref="CommandParameterAttribute" />.
|
||||
/// </summary>
|
||||
public CommandParameterAttribute(int order)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CliApplication
|
||||
private readonly CommandBinder _commandBinder;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CliApplication"/>.
|
||||
/// Initializes an instance of <see cref="CliApplication" />.
|
||||
/// </summary>
|
||||
public CliApplication(
|
||||
ApplicationMetadata metadata,
|
||||
|
||||
@@ -12,7 +12,7 @@ using CliFx.Utils.Extensions;
|
||||
namespace CliFx;
|
||||
|
||||
/// <summary>
|
||||
/// Builder for <see cref="CliApplication"/>.
|
||||
/// Builder for <see cref="CliApplication" />.
|
||||
/// </summary>
|
||||
public partial class CliApplicationBuilder
|
||||
{
|
||||
@@ -58,8 +58,8 @@ public partial class CliApplicationBuilder
|
||||
/// Adds commands from the specified assembly to the application.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method looks for public non-abstract classes that implement <see cref="ICommand"/>
|
||||
/// and are annotated by <see cref="CommandAttribute"/>.
|
||||
/// This method looks for public non-abstract classes that implement <see cref="ICommand" />
|
||||
/// and are annotated by <see cref="CommandAttribute" />.
|
||||
/// </remarks>
|
||||
public CliApplicationBuilder AddCommandsFrom(Assembly commandAssembly)
|
||||
{
|
||||
@@ -73,8 +73,8 @@ public partial class CliApplicationBuilder
|
||||
/// Adds commands from the specified assemblies to the application.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method looks for public non-abstract classes that implement <see cref="ICommand"/>
|
||||
/// and are annotated by <see cref="CommandAttribute"/>.
|
||||
/// This method looks for public non-abstract classes that implement <see cref="ICommand" />
|
||||
/// and are annotated by <see cref="CommandAttribute" />.
|
||||
/// </remarks>
|
||||
public CliApplicationBuilder AddCommandsFrom(IEnumerable<Assembly> commandAssemblies)
|
||||
{
|
||||
@@ -88,8 +88,8 @@ public partial class CliApplicationBuilder
|
||||
/// Adds commands from the calling assembly to the application.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method looks for public non-abstract classes that implement <see cref="ICommand"/>
|
||||
/// and are annotated by <see cref="CommandAttribute"/>.
|
||||
/// This method looks for public non-abstract classes that implement <see cref="ICommand" />
|
||||
/// and are annotated by <see cref="CommandAttribute" />.
|
||||
/// </remarks>
|
||||
public CliApplicationBuilder AddCommandsFromThisAssembly() => AddCommandsFrom(Assembly.GetCallingAssembly());
|
||||
|
||||
@@ -159,7 +159,7 @@ public partial class CliApplicationBuilder
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the application to use the specified implementation of <see cref="IConsole"/>.
|
||||
/// Configures the application to use the specified implementation of <see cref="IConsole" />.
|
||||
/// </summary>
|
||||
public CliApplicationBuilder UseConsole(IConsole console)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ public partial class CliApplicationBuilder
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the application to use the specified implementation of <see cref="ITypeActivator"/>.
|
||||
/// Configures the application to use the specified implementation of <see cref="ITypeActivator" />.
|
||||
/// </summary>
|
||||
public CliApplicationBuilder UseTypeActivator(ITypeActivator typeActivator)
|
||||
{
|
||||
@@ -189,7 +189,7 @@ public partial class CliApplicationBuilder
|
||||
UseTypeActivator(serviceProvider.GetService);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a configured instance of <see cref="CliApplication"/>.
|
||||
/// Creates a configured instance of <see cref="CliApplication" />.
|
||||
/// </summary>
|
||||
public CliApplication Build()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ public partial class CliFxException : Exception
|
||||
public bool ShowHelp { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CliFxException"/>.
|
||||
/// Initializes an instance of <see cref="CliFxException" />.
|
||||
/// </summary>
|
||||
public CliFxException(
|
||||
string message,
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CliFx.Exceptions;
|
||||
public class CommandException : CliFxException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="CommandException"/>.
|
||||
/// Initializes an instance of <see cref="CommandException" />.
|
||||
/// </summary>
|
||||
public CommandException(
|
||||
string message,
|
||||
|
||||
@@ -11,7 +11,7 @@ public class BindingValidationError
|
||||
public string Message { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="BindingValidationError"/>.
|
||||
/// Initializes an instance of <see cref="BindingValidationError" />.
|
||||
/// </summary>
|
||||
public BindingValidationError(string message) => Message = message;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public abstract class BindingValidator<T> : IBindingValidator
|
||||
/// Returns null if validation is successful, or an error in case of failure.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You can use the utility methods <see cref="Ok"/> and <see cref="Error"/> to
|
||||
/// You can use the utility methods <see cref="Ok" /> and <see cref="Error" /> to
|
||||
/// create an appropriate result.
|
||||
/// </remarks>
|
||||
public abstract BindingValidationError? Validate(T? value);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CliFx;
|
||||
public interface ICommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes the command using the specified implementation of <see cref="IConsole"/>.
|
||||
/// Executes the command using the specified implementation of <see cref="IConsole" />.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the execution of the command is not asynchronous, simply end the method with
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a <see cref="TextReader"/> for reading characters from a console stream.
|
||||
/// Implements a <see cref="TextReader" /> for reading characters from a console stream.
|
||||
/// </summary>
|
||||
// Both the underlying stream AND the stream reader must be synchronized!
|
||||
// https://github.com/Tyrrrz/CliFx/issues/123
|
||||
@@ -19,7 +19,7 @@ public partial class ConsoleReader : StreamReader
|
||||
public IConsole Console { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="ConsoleReader"/>.
|
||||
/// Initializes an instance of <see cref="ConsoleReader" />.
|
||||
/// </summary>
|
||||
public ConsoleReader(IConsole console, Stream stream, Encoding encoding)
|
||||
: base(stream, encoding, false, 4096)
|
||||
@@ -28,7 +28,7 @@ public partial class ConsoleReader : StreamReader
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="ConsoleReader"/>.
|
||||
/// Initializes an instance of <see cref="ConsoleReader" />.
|
||||
/// </summary>
|
||||
public ConsoleReader(IConsole console, Stream stream)
|
||||
: this(console, stream, System.Console.InputEncoding)
|
||||
|
||||
@@ -8,7 +8,7 @@ using CliFx.Utils;
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a <see cref="TextWriter"/> for writing characters to a console stream.
|
||||
/// Implements a <see cref="TextWriter" /> for writing characters to a console stream.
|
||||
/// </summary>
|
||||
// Both the underlying stream AND the stream writer must be synchronized!
|
||||
// https://github.com/Tyrrrz/CliFx/issues/123
|
||||
@@ -20,7 +20,7 @@ public partial class ConsoleWriter : StreamWriter
|
||||
public IConsole Console { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="ConsoleWriter"/>.
|
||||
/// Initializes an instance of <see cref="ConsoleWriter" />.
|
||||
/// </summary>
|
||||
public ConsoleWriter(IConsole console, Stream stream, Encoding encoding)
|
||||
: base(stream, encoding.WithoutPreamble(), 256)
|
||||
@@ -29,7 +29,7 @@ public partial class ConsoleWriter : StreamWriter
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="ConsoleWriter"/>.
|
||||
/// Initializes an instance of <see cref="ConsoleWriter" />.
|
||||
/// </summary>
|
||||
public ConsoleWriter(IConsole console, Stream stream)
|
||||
: this(console, stream, System.Console.OutputEncoding)
|
||||
|
||||
@@ -4,7 +4,7 @@ using CliFx.Exceptions;
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="ITypeActivator"/> that instantiates an object
|
||||
/// Implementation of <see cref="ITypeActivator" /> that instantiates an object
|
||||
/// by using its parameterless constructor.
|
||||
/// </summary>
|
||||
public class DefaultTypeActivator : ITypeActivator
|
||||
|
||||
@@ -4,7 +4,7 @@ using CliFx.Exceptions;
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="ITypeActivator"/> that instantiates an object
|
||||
/// Implementation of <see cref="ITypeActivator" /> that instantiates an object
|
||||
/// by using a predefined function.
|
||||
/// </summary>
|
||||
public class DelegateTypeActivator : ITypeActivator
|
||||
@@ -12,7 +12,7 @@ public class DelegateTypeActivator : ITypeActivator
|
||||
private readonly Func<Type, object> _func;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="DelegateTypeActivator"/>.
|
||||
/// Initializes an instance of <see cref="DelegateTypeActivator" />.
|
||||
/// </summary>
|
||||
public DelegateTypeActivator(Func<Type, object> func) => _func = func;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading;
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="IConsole"/> that uses the provided fake
|
||||
/// Implementation of <see cref="IConsole" /> that uses the provided fake
|
||||
/// standard input, output, and error streams.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -54,7 +54,7 @@ public class FakeConsole : IConsole, IDisposable
|
||||
public int CursorTop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="FakeConsole"/>.
|
||||
/// Initializes an instance of <see cref="FakeConsole" />.
|
||||
/// </summary>
|
||||
public FakeConsole(Stream? input = null, Stream? output = null, Stream? error = null)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ public class FakeConsole : IConsole, IDisposable
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Enqueues a simulated key press, which can then be read by calling <see cref="ReadKey"/>.
|
||||
/// Enqueues a simulated key press, which can then be read by calling <see cref="ReadKey" />.
|
||||
/// </summary>
|
||||
public void EnqueueKey(ConsoleKeyInfo key) => _keys.Enqueue(key);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class FakeConsole : IConsole, IDisposable
|
||||
/// Sends a cancellation signal to the currently executing command.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the command is not cancellation-aware (i.e. it doesn't call <see cref="IConsole.RegisterCancellationHandler"/>),
|
||||
/// If the command is not cancellation-aware (i.e. it doesn't call <see cref="IConsole.RegisterCancellationHandler" />),
|
||||
/// this method will not have any effect.
|
||||
/// </remarks>
|
||||
public void RequestCancellation(TimeSpan? delay = null)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="IConsole"/> that uses fake
|
||||
/// Implementation of <see cref="IConsole" /> that uses fake
|
||||
/// standard input, output, and error streams backed by in-memory stores.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -24,7 +24,7 @@ public class FakeInMemoryConsole : FakeConsole
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="FakeInMemoryConsole"/>.
|
||||
/// Initializes an instance of <see cref="FakeInMemoryConsole" />.
|
||||
/// </summary>
|
||||
public FakeInMemoryConsole()
|
||||
: this(new MemoryStream(), new MemoryStream(), new MemoryStream())
|
||||
|
||||
@@ -105,12 +105,12 @@ public interface IConsole
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for <see cref="IConsole"/>.
|
||||
/// Extensions for <see cref="IConsole" />.
|
||||
/// </summary>
|
||||
public static class ConsoleExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the specified foreground color and returns an <see cref="IDisposable"/>
|
||||
/// Sets the specified foreground color and returns an <see cref="IDisposable" />
|
||||
/// that will reset the color back to its previous value upon disposal.
|
||||
/// </summary>
|
||||
public static IDisposable WithForegroundColor(this IConsole console, ConsoleColor foregroundColor)
|
||||
@@ -122,7 +122,7 @@ public static class ConsoleExtensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the specified background color and returns an <see cref="IDisposable"/>
|
||||
/// Sets the specified background color and returns an <see cref="IDisposable" />
|
||||
/// that will reset the color back to its previous value upon disposal.
|
||||
/// </summary>
|
||||
public static IDisposable WithBackgroundColor(this IConsole console, ConsoleColor backgroundColor)
|
||||
@@ -134,7 +134,7 @@ public static class ConsoleExtensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the specified foreground and background colors and returns an <see cref="IDisposable"/>
|
||||
/// Sets the specified foreground and background colors and returns an <see cref="IDisposable" />
|
||||
/// that will reset the colors back to their previous values upon disposal.
|
||||
/// </summary>
|
||||
public static IDisposable WithColors(
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Threading;
|
||||
namespace CliFx.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="IConsole"/> that represents the real system console.
|
||||
/// Implementation of <see cref="IConsole" /> that represents the real system console.
|
||||
/// </summary>
|
||||
public class SystemConsole : IConsole, IDisposable
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public class SystemConsole : IConsole, IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of <see cref="SystemConsole"/>.
|
||||
/// Initializes an instance of <see cref="SystemConsole" />.
|
||||
/// </summary>
|
||||
public SystemConsole()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user