11// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
22
3+ using CommandLine . Infrastructure ;
4+
35using System ;
46using System . Collections . Generic ;
57using System . Linq ;
68using System . Text ;
7- using CommandLine . Infrastructure ;
89
910namespace CommandLine . Text
1011{
@@ -41,7 +42,7 @@ public static SentenceBuilder Create()
4142 /// <summary>
4243 /// Gets a delegate that returns usage text block heading text.
4344 /// </summary>
44- public abstract Func < string > UsageHeadingText { get ; }
45+ public abstract Func < string > UsageHeadingText { get ; }
4546
4647 /// <summary>
4748 /// Get a delegate that returns the help text of help command.
@@ -53,7 +54,7 @@ public static SentenceBuilder Create()
5354 /// Get a delegate that returns the help text of vesion command.
5455 /// The delegates must accept a boolean that is equal <value>true</value> for options; otherwise <value>false</value> for verbs.
5556 /// </summary>
56- public abstract Func < bool , string > VersionCommandText { get ; }
57+ public abstract Func < bool , string > VersionCommandText { get ; }
5758
5859 /// <summary>
5960 /// Gets a delegate that handles singular error formatting.
@@ -67,7 +68,7 @@ public static SentenceBuilder Create()
6768 /// </summary>
6869 public abstract Func < IEnumerable < MutuallyExclusiveSetError > , string > FormatMutuallyExclusiveSetErrors { get ; }
6970
70- private class DefaultSentenceBuilder : SentenceBuilder
71+ private class DefaultSentenceBuilder : SentenceBuilder
7172 {
7273 public override Func < string > RequiredWord
7374 {
@@ -140,6 +141,13 @@ public override Func<Error, string> FormatError
140141 case ErrorType . SetValueExceptionError :
141142 var setValueError = ( SetValueExceptionError ) error ;
142143 return "Error setting value to option '" . JoinTo ( setValueError . NameInfo . NameText , "': " , setValueError . Exception . Message ) ;
144+ case ErrorType . MissingGroupOptionError :
145+ var missingGroupOptionError = ( MissingGroupOptionError ) error ;
146+ return "At least one option from group '" . JoinTo (
147+ missingGroupOptionError . Group ,
148+ "' (" ,
149+ string . Join ( ", " , missingGroupOptionError . Names . Select ( n => n . NameText ) ) ,
150+ ") is required." ) ;
143151 }
144152 throw new InvalidOperationException ( ) ;
145153 } ;
@@ -153,8 +161,8 @@ public override Func<IEnumerable<MutuallyExclusiveSetError>, string> FormatMutua
153161 return errors =>
154162 {
155163 var bySet = from e in errors
156- group e by e . SetName into g
157- select new { SetName = g . Key , Errors = g . ToList ( ) } ;
164+ group e by e . SetName into g
165+ select new { SetName = g . Key , Errors = g . ToList ( ) } ;
158166
159167 var msgs = bySet . Select (
160168 set =>
@@ -169,7 +177,7 @@ group e by e.SetName into g
169177 ( from x in
170178 ( from s in bySet where ! s . SetName . Equals ( set . SetName ) from e in s . Errors select e )
171179 . Distinct ( )
172- select "'" . JoinTo ( x . NameInfo . NameText , "', " ) ) . ToArray ( ) ) ;
180+ select "'" . JoinTo ( x . NameInfo . NameText , "', " ) ) . ToArray ( ) ) ;
173181
174182 return
175183 new StringBuilder ( "Option" )
0 commit comments