diff --git a/src/CommandLine/Error.cs b/src/CommandLine/Error.cs index b6e8a605..ed2b0dce 100644 --- a/src/CommandLine/Error.cs +++ b/src/CommandLine/Error.cs @@ -584,8 +584,12 @@ public bool Equals(MissingGroupOptionError other) public sealed class GroupOptionAmbiguityError : NamedError { + public NameInfo Option; + internal GroupOptionAmbiguityError(NameInfo option) : base(ErrorType.GroupOptionAmbiguityError, option) - { } + { + Option = option; + } } } diff --git a/src/CommandLine/Text/SentenceBuilder.cs b/src/CommandLine/Text/SentenceBuilder.cs index d58bf9c7..cdf8f7d2 100644 --- a/src/CommandLine/Text/SentenceBuilder.cs +++ b/src/CommandLine/Text/SentenceBuilder.cs @@ -158,6 +158,9 @@ public override Func FormatError "' (", string.Join(", ", missingGroupOptionError.Names.Select(n => n.NameText)), ") is required."); + case ErrorType.GroupOptionAmbiguityError: + var groupOptionAmbiguityError = (GroupOptionAmbiguityError)error; + return "Both SetName and Group are not allowed in option: (".JoinTo(groupOptionAmbiguityError.Option.NameText, ")"); } throw new InvalidOperationException(); };