Rename 'dotnet interactive' to 'dotnet repl'

This commit is contained in:
Charles Stoner 2015-11-06 16:11:09 -08:00
parent 645892388b
commit 73ae3e8afb
9 changed files with 26 additions and 26 deletions

View file

@ -0,0 +1,38 @@
using System;
using System.IO;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Repl.Csi
{
public sealed class Program
{
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
var app = new CommandLineApplication();
app.Name = "dotnet repl csi";
app.FullName = "C# REPL";
app.Description = "C# REPL for the .NET platform";
app.HelpOption("-h|--help");
var script = app.Argument("<SCRIPT>", "The .csx file to run. Defaults to interactive mode.");
app.OnExecute(() => Run(script.Value));
return app.Execute(args);
}
private static int Run(string scriptOpt)
{
var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
var csiExe = Path.Combine(AppContext.BaseDirectory, "csi.exe");
var csiArgs = string.IsNullOrEmpty(scriptOpt) ? "-i" : scriptOpt;
var command = File.Exists(corerun) && File.Exists(csiExe) ?
Command.Create(corerun, $@"""{csiExe}"" {csiArgs}") :
Command.Create(csiExe, csiArgs);
command = command.ForwardStdOut().ForwardStdErr();
var result = command.Execute();
return result.ExitCode;
}
}
}