-
Notifications
You must be signed in to change notification settings - Fork 264
Open
Labels
Description
source code
McMaster.Extensions.CommandLineUtils CommandLineProcessor
private bool ProcessUnexpectedArg(string argTypeName, string? argValue = null)
{
switch (_currentCommand.UnrecognizedArgumentHandling)
{
case UnrecognizedArgumentHandling.Throw:
_currentCommand.ShowHint();
var value = argValue ?? _enumerator.Current?.Raw;
var suggestions = Enumerable.Empty<string>();
if (_currentCommand.MakeSuggestionsInErrorMessage && !string.IsNullOrEmpty(value))
{
suggestions = SuggestionCreator.GetTopSuggestions(_currentCommand, value);
}
throw new UnrecognizedCommandParsingException(_currentCommand, suggestions,
$"Unrecognized {argTypeName} '{value}'");
case UnrecognizedArgumentHandling.CollectAndContinue:
var arg = _enumerator.Current;
if (arg != null)
{
_currentCommand._remainingArguments.Add(arg.Raw);
}
return true;
case UnrecognizedArgumentHandling.StopParsingAndCollect:
// All remaining arguments are stored for further use
AddRemainingArgumentValues();
return false;
default:
throw new NotImplementedException();
}
}
when throw UnrecognizedCommandParsingException,this write Specify {flag} for a list of available options and commands.
come from _currentCommand.ShowHint();
What can I do to avoid the_currentCommand.ShowHint(); output while still throwing the 'UnrecognizedCommandParsingException' error
Reactions are currently unavailable