2017-03-09 10:53:17 -08:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using Microsoft.DotNet.Cli.CommandLine;
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
{
|
|
|
|
public class ParseCommand
|
|
|
|
{
|
|
|
|
public static int Run(string[] args)
|
|
|
|
{
|
|
|
|
DebugHelper.HandleDebugSwitch(ref args);
|
|
|
|
|
2017-03-12 15:06:34 -07:00
|
|
|
var result =
|
2017-03-09 10:53:17 -08:00
|
|
|
Parser.Instance.Parse(
|
|
|
|
args.Single());
|
|
|
|
|
2017-03-12 15:06:34 -07:00
|
|
|
Console.WriteLine(result.Diagram());
|
|
|
|
|
|
|
|
if (result.Errors.Any())
|
|
|
|
{
|
|
|
|
Console.WriteLine();
|
|
|
|
Console.WriteLine("ERRORS");
|
|
|
|
Console.WriteLine();
|
|
|
|
foreach (var error in result.Errors)
|
|
|
|
{
|
|
|
|
Console.WriteLine($"[{error?.Option?.Name ?? "???"}] {error.Message}");
|
|
|
|
}
|
|
|
|
}
|
2017-03-09 10:53:17 -08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|