File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
2-
2+ using System ;
3+ using System . IO ;
34using System . Collections . Generic ;
45using System . Linq ;
56
@@ -28,6 +29,15 @@ public static bool IsVersion(this IEnumerable<Error> errs)
2829 return true ;
2930 //when AutoVersion=false in parser, Version is disabled and Parser raise UnknownOptionError
3031 return errs . Any ( x => ( x is UnknownOptionError ee ? ee . Token : "" ) == "version" ) ;
32+ }
33+ /// <summary>
34+ /// redirect errs to Console.Error, and to Console.Out for help/version error
35+ /// </summary>
36+ public static TextWriter Output ( this IEnumerable < Error > errs )
37+ {
38+ if ( errs . IsHelp ( ) || errs . IsVersion ( ) )
39+ return Console . Out ;
40+ return Console . Error ;
3141 }
3242 }
3343}
You can’t perform that action at this time.
0 commit comments