Skip to content

Commit

Permalink
Fix exception of groupOptionAmbiguityError
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-hassan committed Feb 3, 2020
1 parent 17d1bb9 commit 5bb3235
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/CommandLine/Error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
3 changes: 3 additions & 0 deletions src/CommandLine/Text/SentenceBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public override Func<Error, string> 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();
};
Expand Down

0 comments on commit 5bb3235

Please sign in to comment.