dotnet-installer/src/Microsoft.DotNet.Cli/Program.cs

55 lines
1.6 KiB
C#
Raw Normal View History

2015-10-03 18:34:08 +00:00
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
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)
{
if (args.Length < 1)
{
// Handle missing args
2015-10-08 21:49:39 +00:00
PrintCommandList();
return 1;
}
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()
.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()
.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-03 18:34:08 +00:00
}
}