Moved the reporter to shared code

This commit is contained in:
David Fowler 2015-10-20 02:42:29 -07:00
parent 086207ebcc
commit 063eb45f8b
4 changed files with 14 additions and 14 deletions

View file

@ -130,7 +130,7 @@ namespace Microsoft.DotNet.Cli.Utils
#if DEBUG
var sw = Stopwatch.StartNew();
Console.WriteLine($"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments}");
Reporter.Output.WriteLine($"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments}".Green().Bold());
#endif
_process.Start();
_process.BeginOutputReadLine();
@ -139,7 +139,15 @@ namespace Microsoft.DotNet.Cli.Utils
var exitCode = await _processTcs.Task;
#if DEBUG
Console.WriteLine($"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments} exited with {exitCode} in {sw.ElapsedMilliseconds} ms.");
var message = $"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments} exited with {exitCode} in {sw.ElapsedMilliseconds} ms.";
if (exitCode == 0)
{
Reporter.Output.WriteLine(message.Green().Bold());
}
else
{
Reporter.Output.WriteLine(message.Red().Bold());
}
#endif
return new CommandResult(

View file

@ -17,6 +17,10 @@
"Microsoft.DotNet.Cli.Utils": {
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build",
"version": "1.0.0-*"
}
},
"frameworks": {

View file

@ -1,12 +0,0 @@
using System.Runtime.InteropServices;
using Microsoft.Dnx.Runtime.Common.CommandLine;
namespace Microsoft.DotNet.Cli.Utils
{
// Stupid-simple console manager
internal static class Reporter
{
public static AnsiConsole Output { get; } = AnsiConsole.GetOutput(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
public static AnsiConsole Error { get; } = AnsiConsole.GetError(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
}
}