2015-10-03 11:34:08 -07:00
|
|
|
|
using System;
|
2015-10-13 14:31:29 -07:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
2015-10-06 02:19:27 -07:00
|
|
|
|
using System.Linq;
|
2015-10-06 10:46:43 -07:00
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
2015-10-03 11:34:08 -07:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
public static int Main(string[] args)
|
|
|
|
|
{
|
2015-10-06 10:46:43 -07:00
|
|
|
|
if (args.Length < 1)
|
2015-10-06 03:10:26 -07:00
|
|
|
|
{
|
2015-10-06 10:46:43 -07:00
|
|
|
|
// Handle missing args
|
2015-10-08 14:49:39 -07:00
|
|
|
|
PrintCommandList();
|
2015-10-06 10:46:43 -07:00
|
|
|
|
return 1;
|
2015-10-06 03:10:26 -07:00
|
|
|
|
}
|
2015-10-06 02:19:27 -07:00
|
|
|
|
|
2015-10-08 14:49:39 -07:00
|
|
|
|
if (args[0].Equals("help", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (args.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
return Command.Create("dotnet-" + args[1], "--help")
|
|
|
|
|
.ForwardStdErr()
|
|
|
|
|
.ForwardStdOut()
|
2015-10-21 03:11:27 -07:00
|
|
|
|
.Execute()
|
2015-10-08 14:49:39 -07:00
|
|
|
|
.ExitCode;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintCommandList();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Command.Create("dotnet-" + args[0], args.Skip(1))
|
|
|
|
|
.ForwardStdErr()
|
|
|
|
|
.ForwardStdOut()
|
2015-10-21 03:11:27 -07:00
|
|
|
|
.Execute()
|
2015-10-08 14:49:39 -07:00
|
|
|
|
.ExitCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void PrintCommandList()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Some dotnet Commands (use 'dotnet help <command>' to get help):");
|
|
|
|
|
Console.WriteLine("* compile - Compiles code");
|
|
|
|
|
Console.WriteLine("* publish - Publishes a project to a self-contained application");
|
|
|
|
|
Console.WriteLine("* run - Publishes and immediately runs a project");
|
2015-10-06 02:19:27 -07:00
|
|
|
|
}
|
2015-10-03 11:34:08 -07:00
|
|
|
|
}
|
|
|
|
|
}
|