aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-03-14 07:38:48 -0700
committerRob Mensching <rob@firegiant.com>2021-03-14 07:47:48 -0700
commit3ccd5e439da4296d6f2b66ce47075ab20d039676 (patch)
treeb5546552613b869367d09f444492a0bbcfadcfe0 /src/WixToolset.Core/CommandLine
parent574785ab1421c9b67336c13ade5c2263e665ca07 (diff)
downloadwix-3ccd5e439da4296d6f2b66ce47075ab20d039676.tar.gz
wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.tar.bz2
wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.zip
Minimize public surface area of Core
Fixes wixtoolset/issues#6374
Diffstat (limited to 'src/WixToolset.Core/CommandLine')
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLine.cs10
-rw-r--r--src/WixToolset.Core/CommandLine/HelpCommand.cs8
2 files changed, 13 insertions, 5 deletions
diff --git a/src/WixToolset.Core/CommandLine/CommandLine.cs b/src/WixToolset.Core/CommandLine/CommandLine.cs
index 0c21eaaa..7371628b 100644
--- a/src/WixToolset.Core/CommandLine/CommandLine.cs
+++ b/src/WixToolset.Core/CommandLine/CommandLine.cs
@@ -55,7 +55,9 @@ namespace WixToolset.Core.CommandLine
55 55
56 if (command.ShowLogo) 56 if (command.ShowLogo)
57 { 57 {
58 AppCommon.DisplayToolHeader(); 58 var branding = this.ServiceProvider.GetService<IWixBranding>();
59 Console.WriteLine(branding.ReplacePlaceholders("[AssemblyProduct] [AssemblyDescription] version [FileVersion]"));
60 Console.WriteLine(branding.ReplacePlaceholders("[AssemblyCopyright]"));
59 } 61 }
60 62
61 return command; 63 return command;
@@ -73,6 +75,7 @@ namespace WixToolset.Core.CommandLine
73 75
74 private ICommandLineCommand Parse(ICommandLineContext context) 76 private ICommandLineCommand Parse(ICommandLineContext context)
75 { 77 {
78 var branding = context.ServiceProvider.GetService<IWixBranding>();
76 var extensions = context.ExtensionManager.GetServices<IExtensionCommandLine>(); 79 var extensions = context.ExtensionManager.GetServices<IExtensionCommandLine>();
77 80
78 foreach (var extension in extensions) 81 foreach (var extension in extensions)
@@ -118,7 +121,7 @@ namespace WixToolset.Core.CommandLine
118 extension.PostParse(); 121 extension.PostParse();
119 } 122 }
120 123
121 return command ?? new HelpCommand(extensions); 124 return command ?? new HelpCommand(extensions, branding);
122 } 125 }
123 126
124 private bool TryParseCommand(string arg, ICommandLineParser parser, IEnumerable<IExtensionCommandLine> extensions, out ICommandLineCommand command) 127 private bool TryParseCommand(string arg, ICommandLineParser parser, IEnumerable<IExtensionCommandLine> extensions, out ICommandLineCommand command)
@@ -134,7 +137,8 @@ namespace WixToolset.Core.CommandLine
134 case "h": 137 case "h":
135 case "help": 138 case "help":
136 case "-help": 139 case "-help":
137 command = new HelpCommand(extensions); 140 var branding = this.ServiceProvider.GetService<IWixBranding>();
141 command = new HelpCommand(extensions, branding);
138 break; 142 break;
139 143
140 case "version": 144 case "version":
diff --git a/src/WixToolset.Core/CommandLine/HelpCommand.cs b/src/WixToolset.Core/CommandLine/HelpCommand.cs
index 3af442aa..6a5ac183 100644
--- a/src/WixToolset.Core/CommandLine/HelpCommand.cs
+++ b/src/WixToolset.Core/CommandLine/HelpCommand.cs
@@ -19,9 +19,10 @@ namespace WixToolset.Core.CommandLine
19 new ExtensionCommandLineSwitch { Switch = "decompile", Description = "Decompile a package or bundle into source code." }, 19 new ExtensionCommandLineSwitch { Switch = "decompile", Description = "Decompile a package or bundle into source code." },
20 }; 20 };
21 21
22 public HelpCommand(IEnumerable<IExtensionCommandLine> extensions) 22 public HelpCommand(IEnumerable<IExtensionCommandLine> extensions, IWixBranding branding)
23 { 23 {
24 this.Extensions = extensions; 24 this.Extensions = extensions;
25 this.Branding = branding;
25 } 26 }
26 27
27 public bool ShowLogo => true; 28 public bool ShowLogo => true;
@@ -30,6 +31,8 @@ namespace WixToolset.Core.CommandLine
30 31
31 private IEnumerable<IExtensionCommandLine> Extensions { get; } 32 private IEnumerable<IExtensionCommandLine> Extensions { get; }
32 33
34 private IWixBranding Branding { get; }
35
33 public Task<int> ExecuteAsync(CancellationToken _) 36 public Task<int> ExecuteAsync(CancellationToken _)
34 { 37 {
35 var commandLineSwitches = new List<ExtensionCommandLineSwitch>(BuiltInSwitches); 38 var commandLineSwitches = new List<ExtensionCommandLineSwitch>(BuiltInSwitches);
@@ -52,7 +55,8 @@ namespace WixToolset.Core.CommandLine
52 55
53 Console.WriteLine(); 56 Console.WriteLine();
54 Console.WriteLine("Run 'wix [command] --help' for more information on a command."); 57 Console.WriteLine("Run 'wix [command] --help' for more information on a command.");
55 AppCommon.DisplayToolFooter(); 58 Console.WriteLine();
59 Console.WriteLine(this.Branding.ReplacePlaceholders("For more information see: [SupportUrl]"));
56 60
57 return Task.FromResult(-1); 61 return Task.FromResult(-1);
58 } 62 }