From eaf7cb30abc29fef81ecc2375d7c727d3c00be58 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 8 Oct 2015 14:49:39 -0700 Subject: [PATCH] add some readme --- README.md | 7 +++++ src/Microsoft.DotNet.Cli/Program.cs | 42 ++++++++++++++++++++++++----- test/TestApp/project.json | 1 + 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f3ec88cc6..1a463331e 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,10 @@ Right now the CLI uses [DNX](https://github.com/aspnet/dnx) as an application ho * Requires VS 2015 with Web Development Tools installed to open in VS * Requires that you have a DNX installed (the build script _should_ set it up for you though) * Compilation is not required before building, but you must run `dnu restore` (which comes from the DNX commands) after changing dependencies. If you add/remove dependencies in VS, it will run it for you + +## A simple test (windows only for now) + +Note: The explicit `--framework` and `--runtime` switches will definitely be going away :) + +1. `cd test\TestApp` +2. `..\..\scripts\dotnet run --framework dnxcore50 --runtime win7-x86` diff --git a/src/Microsoft.DotNet.Cli/Program.cs b/src/Microsoft.DotNet.Cli/Program.cs index 2ac28da8c..dd231b45d 100644 --- a/src/Microsoft.DotNet.Cli/Program.cs +++ b/src/Microsoft.DotNet.Cli/Program.cs @@ -11,16 +11,44 @@ namespace Microsoft.DotNet.Cli if (args.Length < 1) { // Handle missing args - Console.Error.WriteLine("TODO: Help"); + PrintCommandList(); return 1; } - return Command.Create("dotnet-" + args[0], args.Skip(1)) - .ForwardStdErr(Console.Error) - .ForwardStdOut(Console.Out) - .RunAsync() - .Result - .ExitCode; + if (args[0].Equals("help", StringComparison.OrdinalIgnoreCase)) + { + if (args.Length > 1) + { + return Command.Create("dotnet-" + args[1], "--help") + .ForwardStdErr() + .ForwardStdOut() + .RunAsync() + .Result + .ExitCode; + } + else + { + PrintCommandList(); + return 0; + } + } + else + { + return Command.Create("dotnet-" + args[0], args.Skip(1)) + .ForwardStdErr() + .ForwardStdOut() + .RunAsync() + .Result + .ExitCode; + } + } + + private static void PrintCommandList() + { + Console.WriteLine("Some dotnet Commands (use 'dotnet help ' 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"); } } } diff --git a/test/TestApp/project.json b/test/TestApp/project.json index f3f2f1bee..446911738 100644 --- a/test/TestApp/project.json +++ b/test/TestApp/project.json @@ -1,5 +1,6 @@ { "version": "1.0.0-*", + "emitEntryPoint": true, "dependencies": { "Microsoft.NETCore.ConsoleHost": "1.0.0-*",