include HelpText in CommandParsingError, write it to stdout

This commit is contained in:
Jon Sequeira 2017-03-14 12:26:24 -07:00
parent 22fb17422f
commit 35732fc07d
4 changed files with 20 additions and 7 deletions

View file

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.PlatformAbstractions;
@ -84,9 +85,15 @@ namespace Microsoft.DotNet.Cli
}
catch (Exception e) when (e.ShouldBeDisplayedAsError())
{
Reporter.Error.WriteLine(CommandContext.IsVerbose() ?
e.ToString().Red().Bold() :
e.Message.Red().Bold());
Reporter.Error.WriteLine(CommandContext.IsVerbose()
? e.ToString().Red().Bold()
: e.Message.Red().Bold());
var commandParsingException = e as CommandParsingException;
if (commandParsingException != null)
{
Reporter.Output.WriteLine(commandParsingException.HelpText);
}
return 1;
}