2015-10-03 18:34:08 +00:00
|
|
|
|
using System;
|
2015-10-13 21:31:29 +00:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
2015-10-06 09:19:27 +00:00
|
|
|
|
using System.Linq;
|
2015-10-06 17:46:43 +00:00
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
2015-10-03 18:34:08 +00:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
public static int Main(string[] args)
|
|
|
|
|
{
|
2015-10-06 17:46:43 +00:00
|
|
|
|
if (args.Length < 1)
|
2015-10-06 10:10:26 +00:00
|
|
|
|
{
|
2015-10-06 17:46:43 +00:00
|
|
|
|
// Handle missing args
|
2015-10-08 21:49:39 +00:00
|
|
|
|
PrintCommandList();
|
2015-10-06 17:46:43 +00:00
|
|
|
|
return 1;
|
2015-10-06 10:10:26 +00:00
|
|
|
|
}
|
2015-10-06 09:19:27 +00:00
|
|
|
|
|
2015-10-08 21:49:39 +00:00
|
|
|
|
if (args[0].Equals("help", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (args.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
return Command.Create("dotnet-" + args[1], "--help")
|
|
|
|
|
.ForwardStdErr()
|
|
|
|
|
.ForwardStdOut()
|
2015-10-21 10:11:27 +00:00
|
|
|
|
.Execute()
|
2015-10-08 21:49:39 +00:00
|
|
|
|
.ExitCode;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintCommandList();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Command.Create("dotnet-" + args[0], args.Skip(1))
|
|
|
|
|
.ForwardStdErr()
|
|
|
|
|
.ForwardStdOut()
|
2015-10-21 10:11:27 +00:00
|
|
|
|
.Execute()
|
2015-10-08 21:49:39 +00: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 09:19:27 +00:00
|
|
|
|
}
|
2015-10-03 18:34:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|