@joebigelow / wix / commits / de389d8c

Add the argument to command command-line processing and add xmldoc

Rob Mensching committed Jun 6, 2020 at 15:24 UTC de389d8c8803c3d2fbbf65620695be30fa24754e
3 files changed +44 -4
src/WixToolset.Extensibility/BaseExtensionCommandLine.cs
+2 -2
@@ -9,7 +9,7 @@ namespace WixToolset.Extensibility
9
10 public abstract class BaseExtensionCommandLine : IExtensionCommandLine
11 {
12 - public IEnumerable<ExtensionCommandLineSwitch> CommandLineSwitches => Enumerable.Empty<ExtensionCommandLineSwitch>();
12 + public virtual IEnumerable<ExtensionCommandLineSwitch> CommandLineSwitches => Enumerable.Empty<ExtensionCommandLineSwitch>();
13
14 public virtual void PostParse()
15 {
@@ -24,7 +24,7 @@ namespace WixToolset.Extensibility
24 return false;
25 }
26
27 - public virtual bool TryParseCommand(ICommandLineParser parser, out ICommandLineCommand command)
27 + public virtual bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command)
28 {
29 command = null;
30 return false;
src/WixToolset.Extensibility/Data/ICommandLineCommand.cs
+19
@@ -4,14 +4,33 @@ namespace WixToolset.Extensibility.Data
4 {
5 using WixToolset.Extensibility.Services;
6
7 + /// <summary>
8 + /// Custom command.
9 + /// </summary>
10 public interface ICommandLineCommand
11 {
12 + /// <summary>
13 + /// Indicates the command-line should show the command-line logo.
14 + /// </summary>
15 bool ShowLogo { get; }
16
17 + /// <summary>
18 + /// Indicates the command-line parsing can stop.
19 + /// </summary>
20 bool StopParsing { get; }
21
22 + /// <summary>
23 + /// Executes the command.
24 + /// </summary>
25 + /// <returns>Exit code for the command.</returns>
26 int Execute();
27
28 + /// <summary>
29 + /// Allows the command to parse command-line arguments.
30 + /// </summary>
31 + /// <param name="parser">Parser to help parse the argument and additional arguments.</param>
32 + /// <param name="argument">Argument to parse.</param>
33 + /// <returns>True if the argument is recognized; otherwise false to allow another extension to process it.</returns>
34 bool TryParseArgument(ICommandLineParser parser, string argument);
35 }
36 }
src/WixToolset.Extensibility/IExtensionCommandLine.cs
+23 -2
@@ -7,7 +7,7 @@ namespace WixToolset.Extensibility
7 using WixToolset.Extensibility.Services;
8
9 /// <summary>
10 - /// Interface extensions implement to be able to parse command-line options.
10 + /// Interface extensions implement to be able to parse the command-line.
11 /// </summary>
12 public interface IExtensionCommandLine
13 {
@@ -17,12 +17,33 @@ namespace WixToolset.Extensibility
17 /// <value>The supported command line types for this extension.</value>
18 IEnumerable<ExtensionCommandLineSwitch> CommandLineSwitches { get; }
19
20 + /// <summary>
21 + /// Called before the command-line is parsed.
22 + /// </summary>
23 + /// <param name="context">Information about the command-line to be parsed.</param>
24 void PreParse(ICommandLineContext context);
25
26 + /// <summary>
27 + /// Gives the extension an opportunity pass a command-line argument for another command.
28 + /// </summary>
29 + /// <param name="parser">Parser to help parse the argument and additional arguments.</param>
30 + /// <param name="argument">Argument to parse.</param>
31 + /// <returns>True if the argument is recognized; otherwise false to allow another extension to process it.</returns>
32 bool TryParseArgument(ICommandLineParser parser, string argument);
33
24 - bool TryParseCommand(ICommandLineParser parser, out ICommandLineCommand command);
34 + /// <summary>
35 + /// Gives the extension an opportunity to provide a command.
36 + /// </summary>
37 + /// </summary>
38 + /// <param name="parser">Parser to help parse the argument and additional arguments.</param>
39 + /// <param name="argument">Argument to parse.</param>
40 + /// <param name="command"></param>
41 + /// <returns>True if the argument is recognized as a commond; otherwise false to allow another extension to process it.</returns>
42 + bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command);
43
44 + /// <summary>
45 + /// Called after the command-line is parsed.
46 + /// </summary>
47 void PostParse();
48 }
49 }