From de389d8c8803c3d2fbbf65620695be30fa24754e Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 6 Jun 2020 15:24:04 -0700 Subject: Add the argument to command command-line processing and add xmldoc --- .../BaseExtensionCommandLine.cs | 4 ++-- .../Data/ICommandLineCommand.cs | 19 ++++++++++++++++ .../IExtensionCommandLine.cs | 25 ++++++++++++++++++++-- 3 files changed, 44 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs index 77e8a5bd..5f2ca109 100644 --- a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs @@ -9,7 +9,7 @@ namespace WixToolset.Extensibility public abstract class BaseExtensionCommandLine : IExtensionCommandLine { - public IEnumerable CommandLineSwitches => Enumerable.Empty(); + public virtual IEnumerable CommandLineSwitches => Enumerable.Empty(); public virtual void PostParse() { @@ -24,7 +24,7 @@ namespace WixToolset.Extensibility return false; } - public virtual bool TryParseCommand(ICommandLineParser parser, out ICommandLineCommand command) + public virtual bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command) { command = null; return false; diff --git a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs index 1c6de205..a0fc9454 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs @@ -4,14 +4,33 @@ namespace WixToolset.Extensibility.Data { using WixToolset.Extensibility.Services; + /// + /// Custom command. + /// public interface ICommandLineCommand { + /// + /// Indicates the command-line should show the command-line logo. + /// bool ShowLogo { get; } + /// + /// Indicates the command-line parsing can stop. + /// bool StopParsing { get; } + /// + /// Executes the command. + /// + /// Exit code for the command. int Execute(); + /// + /// Allows the command to parse command-line arguments. + /// + /// Parser to help parse the argument and additional arguments. + /// Argument to parse. + /// True if the argument is recognized; otherwise false to allow another extension to process it. bool TryParseArgument(ICommandLineParser parser, string argument); } } diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index 0cbf84d9..45683373 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -7,7 +7,7 @@ namespace WixToolset.Extensibility using WixToolset.Extensibility.Services; /// - /// Interface extensions implement to be able to parse command-line options. + /// Interface extensions implement to be able to parse the command-line. /// public interface IExtensionCommandLine { @@ -17,12 +17,33 @@ namespace WixToolset.Extensibility /// The supported command line types for this extension. IEnumerable CommandLineSwitches { get; } + /// + /// Called before the command-line is parsed. + /// + /// Information about the command-line to be parsed. void PreParse(ICommandLineContext context); + /// + /// Gives the extension an opportunity pass a command-line argument for another command. + /// + /// Parser to help parse the argument and additional arguments. + /// Argument to parse. + /// True if the argument is recognized; otherwise false to allow another extension to process it. bool TryParseArgument(ICommandLineParser parser, string argument); - bool TryParseCommand(ICommandLineParser parser, out ICommandLineCommand command); + /// + /// Gives the extension an opportunity to provide a command. + /// + /// + /// Parser to help parse the argument and additional arguments. + /// Argument to parse. + /// + /// True if the argument is recognized as a commond; otherwise false to allow another extension to process it. + bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command); + /// + /// Called after the command-line is parsed. + /// void PostParse(); } } -- cgit v1.2.3-55-g6feb