aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CommandLineParser.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-01-07 23:12:49 -0800
committerRob Mensching <rob@firegiant.com>2021-01-08 15:47:31 -0800
commite35ee2e8c58bf55da5f3d04915d588fb04d6809d (patch)
tree4bf0cfd782ec990b6a5d4ac9aec390d44dee097b /src/WixToolset.Core/CommandLine/CommandLineParser.cs
parent458ff7ce24b33f6df46ae8ef728685c555d55ff7 (diff)
downloadwix-e35ee2e8c58bf55da5f3d04915d588fb04d6809d.tar.gz
wix-e35ee2e8c58bf55da5f3d04915d588fb04d6809d.tar.bz2
wix-e35ee2e8c58bf55da5f3d04915d588fb04d6809d.zip
Report invalid command line arguments as errors
Fixes wixtoolset/issues#6313
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CommandLineParser.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLineParser.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs
index e78da47e..015d3e62 100644
--- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs
+++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs
@@ -12,7 +12,7 @@ namespace WixToolset.Core.CommandLine
12 { 12 {
13 private const string ExpectedArgument = "expected argument"; 13 private const string ExpectedArgument = "expected argument";
14 14
15 public string ErrorArgument { get; set; } 15 public string ErrorArgument { get; private set; }
16 16
17 private Queue<string> RemainingArguments { get; } 17 private Queue<string> RemainingArguments { get; }
18 18
@@ -122,6 +122,12 @@ namespace WixToolset.Core.CommandLine
122 return false; 122 return false;
123 } 123 }
124 124
125 public void ReportErrorArgument(string argument, Message message = null)
126 {
127 this.Messaging.Write(message ?? ErrorMessages.AdditionalArgumentUnexpected(argument));
128 this.ErrorArgument = argument;
129 }
130
125 public bool TryGetNextSwitchOrArgument(out string arg) 131 public bool TryGetNextSwitchOrArgument(out string arg)
126 { 132 {
127 if (this.RemainingArguments.Count > 0) 133 if (this.RemainingArguments.Count > 0)