aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-08-11 17:40:06 -0700
committerRob Mensching <rob@firegiant.com>2022-08-15 06:49:36 -0700
commita6f8b6fa3903d846cdc2fbe715ca951d83af3107 (patch)
treee1c554fc6c386c5dc881d288661aa0d1ba0a84a4 /src/tools
parent4a21abbfc4d3b18bda3547a6c792be9f21df356e (diff)
downloadwix-a6f8b6fa3903d846cdc2fbe715ca951d83af3107.tar.gz
wix-a6f8b6fa3903d846cdc2fbe715ca951d83af3107.tar.bz2
wix-a6f8b6fa3903d846cdc2fbe715ca951d83af3107.zip
Redesign command-line help to meet the needs of WiX v4
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/heat/HeatCommand.cs22
-rw-r--r--src/tools/heat/HeatCommandLine.cs6
-rw-r--r--src/tools/heat/HelpCommand.cs17
3 files changed, 22 insertions, 23 deletions
diff --git a/src/tools/heat/HeatCommand.cs b/src/tools/heat/HeatCommand.cs
index 56277004..6815acd6 100644
--- a/src/tools/heat/HeatCommand.cs
+++ b/src/tools/heat/HeatCommand.cs
@@ -11,13 +11,16 @@ namespace WixToolset.Harvesters
11 using System.Threading.Tasks; 11 using System.Threading.Tasks;
12 using System.Xml; 12 using System.Xml;
13 using WixToolset.Data; 13 using WixToolset.Data;
14 using WixToolset.Extensibility;
14 using WixToolset.Extensibility.Data; 15 using WixToolset.Extensibility.Data;
15 using WixToolset.Extensibility.Services; 16 using WixToolset.Extensibility.Services;
16 using WixToolset.Harvesters.Extensibility; 17 using WixToolset.Harvesters.Extensibility;
17 using Wix = WixToolset.Harvesters.Serialize; 18 using Wix = WixToolset.Harvesters.Serialize;
18 19
19 internal class HeatCommand : ICommandLineCommand 20 internal class HeatCommand : BaseCommandLineCommand
20 { 21 {
22 private bool showLogo;
23
21 public HeatCommand(string harvestType, IList<IHeatExtension> extensions, IServiceProvider serviceProvider) 24 public HeatCommand(string harvestType, IList<IHeatExtension> extensions, IServiceProvider serviceProvider)
22 { 25 {
23 this.Extensions = extensions; 26 this.Extensions = extensions;
@@ -28,11 +31,7 @@ namespace WixToolset.Harvesters
28 this.ExtensionOptions.Add(harvestType); 31 this.ExtensionOptions.Add(harvestType);
29 } 32 }
30 33
31 public bool ShowHelp { get; set; } 34 public override bool ShowLogo => this.showLogo;
32
33 public bool ShowLogo { get; set; }
34
35 public bool StopParsing { get; private set; }
36 35
37 private string ExtensionArgument { get; set; } 36 private string ExtensionArgument { get; set; }
38 37
@@ -50,13 +49,18 @@ namespace WixToolset.Harvesters
50 49
51 private IServiceProvider ServiceProvider { get; } 50 private IServiceProvider ServiceProvider { get; }
52 51
53 public Task<int> ExecuteAsync(CancellationToken cancellationToken) 52 public override CommandLineHelp GetCommandLineHelp()
53 {
54 return null;
55 }
56
57 public override Task<int> ExecuteAsync(CancellationToken cancellationToken)
54 { 58 {
55 var exitCode = this.Harvest(); 59 var exitCode = this.Harvest();
56 return Task.FromResult(exitCode); 60 return Task.FromResult(exitCode);
57 } 61 }
58 62
59 public bool TryParseArgument(ICommandLineParser parser, string arg) 63 public override bool TryParseArgument(ICommandLineParser parser, string arg)
60 { 64 {
61 if (this.ExtensionArgument == null) 65 if (this.ExtensionArgument == null)
62 { 66 {
@@ -67,7 +71,7 @@ namespace WixToolset.Harvesters
67 string parameter = arg.Substring(1); 71 string parameter = arg.Substring(1);
68 if ("nologo" == parameter) 72 if ("nologo" == parameter)
69 { 73 {
70 this.ShowLogo = false; 74 this.showLogo = false;
71 } 75 }
72 else if ("o" == parameter || "out" == parameter) 76 else if ("o" == parameter || "out" == parameter)
73 { 77 {
diff --git a/src/tools/heat/HeatCommandLine.cs b/src/tools/heat/HeatCommandLine.cs
index b11dda4e..f299266d 100644
--- a/src/tools/heat/HeatCommandLine.cs
+++ b/src/tools/heat/HeatCommandLine.cs
@@ -13,19 +13,17 @@ namespace WixToolset.Harvesters
13 13
14 internal class HeatCommandLine : IHeatCommandLine 14 internal class HeatCommandLine : IHeatCommandLine
15 { 15 {
16 private readonly List<IHeatExtension> extensions;
17 private readonly IMessaging messaging;
18 private readonly IServiceProvider serviceProvider; 16 private readonly IServiceProvider serviceProvider;
17 private readonly List<IHeatExtension> extensions;
19 18
20 public HeatCommandLine(IServiceProvider serviceProvider, IEnumerable<IHeatExtension> heatExtensions) 19 public HeatCommandLine(IServiceProvider serviceProvider, IEnumerable<IHeatExtension> heatExtensions)
21 { 20 {
21 this.serviceProvider = serviceProvider;
22 this.extensions = new List<IHeatExtension> { new IIsHeatExtension(), new UtilHeatExtension(serviceProvider), new VSHeatExtension() }; 22 this.extensions = new List<IHeatExtension> { new IIsHeatExtension(), new UtilHeatExtension(serviceProvider), new VSHeatExtension() };
23 if (heatExtensions != null) 23 if (heatExtensions != null)
24 { 24 {
25 this.extensions.AddRange(heatExtensions); 25 this.extensions.AddRange(heatExtensions);
26 } 26 }
27 this.messaging = serviceProvider.GetService<IMessaging>();
28 this.serviceProvider = serviceProvider;
29 } 27 }
30 28
31 public ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments) 29 public ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments)
diff --git a/src/tools/heat/HelpCommand.cs b/src/tools/heat/HelpCommand.cs
index d991b4fa..25d8cd87 100644
--- a/src/tools/heat/HelpCommand.cs
+++ b/src/tools/heat/HelpCommand.cs
@@ -8,12 +8,13 @@ namespace WixToolset.Harvesters
8 using System.Diagnostics; 8 using System.Diagnostics;
9 using System.Threading; 9 using System.Threading;
10 using System.Threading.Tasks; 10 using System.Threading.Tasks;
11 using WixToolset.Extensibility;
11 using WixToolset.Extensibility.Data; 12 using WixToolset.Extensibility.Data;
12 using WixToolset.Extensibility.Services; 13 using WixToolset.Extensibility.Services;
13 using WixToolset.Harvesters.Data; 14 using WixToolset.Harvesters.Data;
14 using WixToolset.Harvesters.Extensibility; 15 using WixToolset.Harvesters.Extensibility;
15 16
16 internal class HelpCommand : ICommandLineCommand 17 internal class HelpCommand : BaseCommandLineCommand
17 { 18 {
18 const string HelpMessageOptionFormat = " {0,-7} {1}"; 19 const string HelpMessageOptionFormat = " {0,-7} {1}";
19 20
@@ -24,17 +25,12 @@ namespace WixToolset.Harvesters
24 25
25 private IList<IHeatExtension> Extensions { get; } 26 private IList<IHeatExtension> Extensions { get; }
26 27
27 public bool ShowHelp { get; set; } 28 public override CommandLineHelp GetCommandLineHelp()
28
29 public bool ShowLogo
30 { 29 {
31 get => false; 30 return null;
32 set { }
33 } 31 }
34 32
35 public bool StopParsing => true; 33 public override Task<int> ExecuteAsync(CancellationToken cancellationToken)
36
37 public Task<int> ExecuteAsync(CancellationToken cancellationToken)
38 { 34 {
39 var exitCode = this.DisplayHelp(); 35 var exitCode = this.DisplayHelp();
40 return Task.FromResult(exitCode); 36 return Task.FromResult(exitCode);
@@ -50,8 +46,9 @@ namespace WixToolset.Harvesters
50 Console.WriteLine(); 46 Console.WriteLine();
51 } 47 }
52 48
53 public bool TryParseArgument(ICommandLineParser parser, string argument) 49 public override bool TryParseArgument(ICommandLineParser parser, string argument)
54 { 50 {
51 this.StopParsing = true;
55 return true; 52 return true;
56 } 53 }
57 54