Skip to content

Commit

Permalink
Add XML Comments (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenswan committed Oct 2, 2023
1 parent e07eaac commit 6d2e632
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 75 deletions.
22 changes: 12 additions & 10 deletions src/CommandLine/src/AutomationConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
namespace BlazorFocused.Automation.CommandLine;

/// <summary>
///
/// Console automation class used to register commands and run them based on command line arguments
/// </summary>
public class AutomationConsole
{
/// <summary>
///
/// Generate default command builder with no root implementation
/// </summary>
/// <param name="appDescription"></param>
/// <param name="args"></param>
/// <returns></returns>
/// <param name="appDescription">Description of command suite to show in help menu</param>
/// <param name="args">Command line arguments of current process</param>
/// <returns>Automation Command builder used to add commands</returns>
/// <remarks>If command line arguments are not sent, <see cref="Environment.GetCommandLineArgs"/> will be used instead</remarks>
public static IAutomationConsoleBuilder CreateDefaultBuilder(string appDescription = null, string[] args = null)
{
var rootCommand = new RootCommand(appDescription ?? string.Empty);
Expand All @@ -27,12 +28,13 @@ public static IAutomationConsoleBuilder CreateDefaultBuilder(string appDescripti
}

/// <summary>
///
/// Generate default command builder with implementation at a root level
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="appDescription"></param>
/// <param name="args"></param>
/// <returns></returns>
/// <typeparam name="T">Type that represents root level command implementation</typeparam>
/// <param name="appDescription">Description of command suite to show in help menu</param>
/// <param name="args">Command line arguments of current process</param>
/// <returns>Automation Command builder used to add commands</returns>
/// <remarks>If command line arguments are not sent, <see cref="Environment.GetCommandLineArgs"/> will be used instead</remarks>
public static IAutomationConsoleBuilder CreateDefaultBuilder<T>(string appDescription = null, string[] args = null)
where T : IConsoleCommand, new()
{
Expand Down
10 changes: 5 additions & 5 deletions src/CommandLine/src/IAutomationConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
namespace BlazorFocused.Automation.CommandLine;

/// <summary>
///
/// Console automation class used to register commands and run them based on command line arguments
/// </summary>
public interface IAutomationConsole
{
/// <summary>
///
/// Run registered command synchronously based on command line arguments
/// </summary>
/// <returns></returns>
/// <returns>Result status code for process</returns>
int Run();

/// <summary>
///
/// Run registered command asynchronously based on command line arguments
/// </summary>
/// <returns></returns>
/// <returns>Result status code for process</returns>
Task<int> RunAsync();
}
14 changes: 7 additions & 7 deletions src/CommandLine/src/IAutomationConsoleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
namespace BlazorFocused.Automation.CommandLine;

/// <summary>
///
/// Automation command builder used to register commands
/// </summary>
public interface IAutomationConsoleBuilder
{
/// <summary>
///
/// Add command to registered command path/pipeline
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="commandPath"></param>
/// <returns></returns>
/// <typeparam name="T">Type of command implementation</typeparam>
/// <param name="commandPath">Path to register command (command and subcommand path)</param>
/// <returns>Builder pattern object used for registration continuation</returns>
IAutomationConsoleBuilder AddCommand<T>(params string[] commandPath) where T : IConsoleCommand, new();

/// <summary>
///
/// Finalize command registration and build automation console
/// </summary>
/// <returns></returns>
/// <returns>Automation console that will run registered process</returns>
IAutomationConsole Build();
}
8 changes: 4 additions & 4 deletions src/CommandLine/src/IConsoleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
namespace BlazorFocused.Automation.CommandLine;

/// <summary>
///
/// Command line automation interface used to register/build commands
/// </summary>
public interface IConsoleCommand : IAutomationStartup
{
/// <summary>
///
/// Set specific command configuration/properties
/// </summary>
/// <param name="serviceBinderFactory"></param>
/// <param name="command"></param>
/// <param name="serviceBinderFactory">Factory used to bind services based on inherited <see cref="IAutomationStartup"/> dependency injection</param>
/// <param name="command">Current command context to establish properties, configuration, and attributes</param>
void ConfigureCommand(IServiceBinderFactory serviceBinderFactory, Command command);
}
8 changes: 4 additions & 4 deletions src/CommandLine/src/IServiceBinderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
namespace BlazorFocused.Automation.CommandLine;

/// <summary>
///
/// Factory of services used to bind to command line services
/// </summary>
public interface IServiceBinderFactory
{
/// <summary>
///
/// Binds registered services to registered command handlers
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
/// <typeparam name="T">Type of Service needed for implementation</typeparam>
/// <returns>Custom type binding for downstream dependency injection</returns>
public BinderBase<T> Bind<T>();
}
4 changes: 2 additions & 2 deletions src/CommandLine/src/StandardCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
namespace BlazorFocused.Automation.CommandLine;

/// <summary>
///
/// Default command implementation used to register commands
/// </summary>
public abstract class StandardCommand : AutomationStartup, IConsoleCommand
{
/// <summary>
///
/// Command name used for logging and help menu
/// </summary>
public string ApplicationName => RootCommand.ExecutableName;

Expand Down
10 changes: 5 additions & 5 deletions src/PowerShell/PowerShell/src/AutomationShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
namespace BlazorFocused.Automation.PowerShell;

/// <summary>
///
/// Standard automation class used to run synchronous PowerShell automation commands
/// </summary>
/// <typeparam name="TStartup"></typeparam>
/// <typeparam name="TStartup">Type of automation startup services class</typeparam>
public abstract class AutomationShell<TStartup> : PSCmdlet where TStartup : IAutomationStartup, new()
{
internal string CommandName => MyInvocation.InvocationName;

/// <summary>
///
/// Pre-process preparation for command execution
/// </summary>
protected override void BeginProcessing()
{
Expand All @@ -33,7 +33,7 @@ protected override void BeginProcessing()
}

/// <summary>
///
/// Main command execution process
/// </summary>
protected override void ProcessRecord()
{
Expand All @@ -43,7 +43,7 @@ protected override void ProcessRecord()
}

/// <summary>
///
/// Post-process cleanup after command execution
/// </summary>
protected override void EndProcessing()
{
Expand Down
12 changes: 5 additions & 7 deletions src/PowerShell/PowerShell/src/AutomationShellAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
namespace BlazorFocused.Automation.PowerShell;

/// <summary>
///
/// Standard automation class used to run asynchronous PowerShell automation commands
/// </summary>
/// <typeparam name="TStartup"></typeparam>
/// <typeparam name="TStartup">Type of automation startup services class</typeparam>
public abstract class AutomationShellAsync<TStartup> : AutomationShell<TStartup>
where TStartup : IAutomationStartup, new()
{
/// <summary>
///
/// Main command execution process
/// </summary>
/// <returns></returns>
/// <returns>Asynchronous task of main command execution process</returns>
protected abstract Task ProcessRecordAsync();

/// <summary>
///
/// </summary>
/// <inheritdoc />
protected sealed override void ProcessRecord() => ProcessRecordAsync().Wait();
}
18 changes: 9 additions & 9 deletions src/PowerShell/Tools/src/AutomationSandbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
namespace BlazorFocused.Automation.PowerShell.Tools;

/// <summary>
///
/// Sandbox for running automation commands in isolation
/// </summary>
public static class AutomationSandbox
{
/// <summary>
///
/// Create sandboxed automation context to run automation commands in isolation
/// </summary>
/// <typeparam name="TCommand"></typeparam>
/// <typeparam name="TStartup"></typeparam>
/// <param name="buildServices"></param>
/// <returns></returns>
/// <typeparam name="TCommand">Type of command used to establish context</typeparam>
/// <typeparam name="TStartup">Type of service/configuration registration</typeparam>
/// <param name="buildServices">Service to register for sandboxed instance</param>
/// <returns>Command instance to run</returns>
public static IAutomationCommand<TCommand> CreateContext<TCommand, TStartup>(Action<IServiceCollection> buildServices)
where TCommand : PSCmdlet
where TStartup : IAutomationStartup, new() =>
new AutomationContextCommand<TCommand, TStartup>(buildServices);

/// <summary>
///
/// Standard automation command
/// </summary>
/// <typeparam name="TCommand"></typeparam>
/// <returns></returns>
/// <typeparam name="TCommand">Type of automation command to create instance from</typeparam>
/// <returns>Command instance to run</returns>
public static IAutomationCommand<TCommand> CreateCommand<TCommand>()
where TCommand : PSCmdlet, new() =>
new AutomationCommand<TCommand>();
Expand Down
44 changes: 22 additions & 22 deletions src/PowerShell/Tools/src/IAutomationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,53 @@
namespace BlazorFocused.Automation.PowerShell.Tools;

/// <summary>
///
/// PowerShell automation command interface.
/// </summary>
/// <typeparam name="TCommand"></typeparam>
public interface IAutomationCommand<TCommand> : IDisposable where TCommand : PSCmdlet
{
/// <summary>
///
/// Add path for modules to import into sandboxed PowerShell session.
/// </summary>
/// <param name="modulePath"></param>
/// <param name="modulePath">Path to module being imported</param>
void ImportModule(string modulePath);

/// <summary>
///
/// Run PowerShell command
/// </summary>
/// <param name="buildCommand"></param>
/// <returns></returns>
/// <param name="buildCommand">Add additional properties and parameters to PowerShell command being run</param>
/// <returns>Response object returned from isolated PowerShell process</returns>
ICollection<PSObject> RunCommand(Action<PSCommand> buildCommand = null);

/// <summary>
///
/// Run command that returns strongly-typed response object
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="buildCommand"></param>
/// <returns></returns>
/// <typeparam name="T">Type of return object coming from command completion</typeparam>
/// <param name="buildCommand">Add additional properties and parameters to PowerShell command being run</param>
/// <returns>Response object returned from isolated PowerShell process</returns>
ICollection<T> RunCommand<T>(Action<PSCommand> buildCommand = null);

/// <summary>
///
/// Run external or built-in PowerShell Command
/// </summary>
/// <param name="name"></param>
/// <param name="buildCommand"></param>
/// <returns></returns>
/// <param name="name">Command name to run (i.e. Get-Help, Set-Location, Get-ChildItem, etc.)</param>
/// <param name="buildCommand">Add additional properties and parameters to PowerShell command being run</param>
/// <returns>Response object returned from isolated PowerShell process</returns>
ICollection<PSObject> RunExternalCommand(string name, Action<PSCommand> buildCommand = null);

/// <summary>
///
/// Run external or built-in PowerShell Command
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="name"></param>
/// <param name="buildCommand"></param>
/// <returns></returns>
/// <typeparam name="T">Type of return object coming from command completion</typeparam>
/// <param name="name">Command name to run (i.e. Get-Help, Set-Location, Get-ChildItem, etc.)</param>
/// <param name="buildCommand">Add additional properties and parameters to PowerShell command being run</param>
/// <returns>Response object returned from isolated PowerShell process</returns>
ICollection<T> RunExternalCommand<T>(string name, Action<PSCommand> buildCommand = null);

/// <summary>
///
/// Sets global variable to be used in PowerShell session.
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
/// <param name="name">Name/Key of PowerShell variable</param>
/// <param name="value">Value of PowerShell variable</param>
void SetVariable(string name, object value);
}

0 comments on commit 6d2e632

Please sign in to comment.