diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine')
| -rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 6 | ||||
| -rw-r--r-- | src/WixToolset.Core/CommandLine/CommandLine.cs | 6 | ||||
| -rw-r--r-- | src/WixToolset.Core/CommandLine/CommandLineParser.cs | 8 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index fed95958..065467bd 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
| @@ -841,8 +841,7 @@ namespace WixToolset.Core.CommandLine | |||
| 841 | } | 841 | } |
| 842 | else | 842 | else |
| 843 | { | 843 | { |
| 844 | this.Messaging.Write(ErrorMessages.IllegalSuppressWarningId(paramArg)); | 844 | parser.ReportErrorArgument(parameter, ErrorMessages.IllegalSuppressWarningId(paramArg)); |
| 845 | parser.ErrorArgument = parameter; | ||
| 846 | } | 845 | } |
| 847 | } | 846 | } |
| 848 | 847 | ||
| @@ -859,8 +858,7 @@ namespace WixToolset.Core.CommandLine | |||
| 859 | } | 858 | } |
| 860 | else | 859 | else |
| 861 | { | 860 | { |
| 862 | this.Messaging.Write(ErrorMessages.IllegalSuppressWarningId(paramArg)); | 861 | parser.ReportErrorArgument(parameter, ErrorMessages.IllegalSuppressWarningId(paramArg)); |
| 863 | parser.ErrorArgument = parameter; | ||
| 864 | } | 862 | } |
| 865 | } | 863 | } |
| 866 | } | 864 | } |
diff --git a/src/WixToolset.Core/CommandLine/CommandLine.cs b/src/WixToolset.Core/CommandLine/CommandLine.cs index 5439eb39..0c21eaaa 100644 --- a/src/WixToolset.Core/CommandLine/CommandLine.cs +++ b/src/WixToolset.Core/CommandLine/CommandLine.cs | |||
| @@ -97,19 +97,19 @@ namespace WixToolset.Core.CommandLine | |||
| 97 | { | 97 | { |
| 98 | if (!this.TryParseCommand(arg, parser, extensions, out command)) | 98 | if (!this.TryParseCommand(arg, parser, extensions, out command)) |
| 99 | { | 99 | { |
| 100 | parser.ErrorArgument = arg; | 100 | parser.ReportErrorArgument(arg); |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | else if (parser.IsSwitch(arg)) | 103 | else if (parser.IsSwitch(arg)) |
| 104 | { | 104 | { |
| 105 | if (!command.TryParseArgument(parser, arg) && !TryParseCommandLineArgumentWithExtension(arg, parser, extensions)) | 105 | if (!command.TryParseArgument(parser, arg) && !TryParseCommandLineArgumentWithExtension(arg, parser, extensions)) |
| 106 | { | 106 | { |
| 107 | parser.ErrorArgument = arg; | 107 | parser.ReportErrorArgument(arg); |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| 110 | else if (!TryParseCommandLineArgumentWithExtension(arg, parser, extensions) && !command.TryParseArgument(parser, arg)) | 110 | else if (!TryParseCommandLineArgumentWithExtension(arg, parser, extensions) && !command.TryParseArgument(parser, arg)) |
| 111 | { | 111 | { |
| 112 | parser.ErrorArgument = arg; | 112 | parser.ReportErrorArgument(arg); |
| 113 | } | 113 | } |
| 114 | } | 114 | } |
| 115 | 115 | ||
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) |
