@joebigelow / wix / commits / ce397dd6

Introduce simplified command creation methods plus xmldoc

Rob Mensching committed Jun 13, 2020 at 09:53 UTC ce397dd68b6699092d0b038b9a8c353f1f6a425d
2 files changed +38 -5
src/WixToolset.Extensibility/Data/ICommandLineArguments.cs
+16 -1
@@ -1,9 +1,12 @@
1 -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
1 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3 namespace WixToolset.Extensibility.Data
4 {
5 using WixToolset.Extensibility.Services;
6
7 + /// <summary>
8 + /// Parsed command-line arguments.
9 + /// </summary>
10 public interface ICommandLineArguments
11 {
12 string[] OriginalArguments { get; set; }
@@ -14,10 +17,22 @@ namespace WixToolset.Extensibility.Data
17
18 string ErrorArgument { get; set; }
19
20 + /// <summary>
21 + /// Populate this argument from a string.
22 + /// </summary>
23 + /// <param name="commandLine">String to parse.</param>
24 void Populate(string commandLine);
25
26 + /// <summary>
27 + /// Populate this argument from array of strings.
28 + /// </summary>
29 + /// <param name="args">Array of strings.</param>
30 void Populate(string[] args);
31
32 + /// <summary>
33 + /// Parses this arguments after it is populated.
34 + /// </summary>
35 + /// <returns>Parser for this arguments.</returns>
36 ICommandLineParser Parse();
37 }
38 }
src/WixToolset.Extensibility/Services/ICommandLine.cs
+22 -4
@@ -1,15 +1,33 @@
1 -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
1 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3 namespace WixToolset.Extensibility.Services
4 {
5 using WixToolset.Extensibility.Data;
6
7 + /// <summary>
8 + /// Command-line parsing mechanism.
9 + /// </summary>
10 public interface ICommandLine
11 {
9 - IExtensionManager ExtensionManager { get; set; }
12 + /// <summary>
13 + /// Simple way to parse arguments and create a command.
14 + /// </summary>
15 + /// <param name="args">Unparsed arguments.</param>
16 + /// <returns>Command if the command-line arguments can be parsed, otherwise null.</returns>
17 + ICommandLineCommand CreateCommand(string[] args);
18
11 - ICommandLineArguments Arguments { get; set; }
19 + /// <summary>
20 + /// Simple way to parse arguments and create a command.
21 + /// </summary>
22 + /// <param name="commandLine">Unparsed arguments.</param>
23 + /// <returns>Command if the command-line arguments can be parsed, otherwise null.</returns>
24 + ICommandLineCommand CreateCommand(string commandLine);
25
13 - ICommandLineCommand ParseStandardCommandLine();
26 + /// <summary>
27 + /// Creates a command from populated arguments.
28 + /// </summary>
29 + /// <param name="arguments">Parsed arguments.</param>
30 + /// <returns>Command if the command-line arguments can be parsed, otherwise null.</returns>
31 + ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments);
32 }
33 }