Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 051c686

Browse filesBrowse files
authored
Merge pull request #394 from filipw/feature/command-history
Added support for REPL command history
2 parents 52bcabd + 6e2f763 commit 051c686
Copy full SHA for 051c686

File tree

4 files changed

+16
-4
lines changed
Filter options

4 files changed

+16
-4
lines changed

‎src/Dotnet.Script.Core/Dotnet.Script.Core.csproj

Copy file name to clipboardExpand all lines: src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn.</Description>
5-
<VersionPrefix>0.27.1</VersionPrefix>
5+
<VersionPrefix>0.28.0</VersionPrefix>
66
<Authors>filipw</Authors>
77
<TargetFramework>netstandard2.0</TargetFramework>
88
<AssemblyName>Dotnet.Script.Core</AssemblyName>
@@ -36,6 +36,7 @@
3636
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.9.0" />
3737
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
3838
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
39+
<PackageReference Include="ReadLine" Version="2.0.1" />
3940
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
4041
<PackageReference Include="System.Reflection.Metadata" Version="1.6.0" />
4142
<PackageReference Include="System.ValueTuple" Version="4.5.0" />

‎src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs

Copy file name to clipboardExpand all lines: src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private string ReadInput()
126126

127127
while (true)
128128
{
129-
var line = Console.In.ReadLine();
129+
var line = Console.ReadLine();
130130
input.AppendLine(line);
131131

132132
var syntaxTree = SyntaxFactory.ParseSyntaxTree(input.ToString(), ParseOptions);

‎src/Dotnet.Script.Core/ScriptConsole.cs

Copy file name to clipboardExpand all lines: src/Dotnet.Script.Core/ScriptConsole.cs
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using System;
22
using System.IO;
3+
using RL = System.ReadLine;
34

45
namespace Dotnet.Script.Core
56
{
67
public class ScriptConsole
78
{
8-
public static readonly ScriptConsole Default = new ScriptConsole(Console.Out, Console.In, Console.Error);
9+
public static readonly ScriptConsole Default = new ScriptConsole(Console.Out, null, Console.Error);
910

1011
public virtual TextWriter Error { get; }
1112
public virtual TextWriter Out { get; }
@@ -39,8 +40,18 @@ public virtual void WriteNormal(string value)
3940
Out.WriteLine(value.TrimEnd(Environment.NewLine.ToCharArray()));
4041
}
4142

43+
public virtual string ReadLine()
44+
{
45+
return In == null ? RL.Read() : In.ReadLine();
46+
}
47+
4248
public ScriptConsole(TextWriter output, TextReader input, TextWriter error)
4349
{
50+
if (input == null)
51+
{
52+
RL.HistoryEnabled = true;
53+
}
54+
4455
Out = output;
4556
Error = error;
4657
In = input;

‎src/Dotnet.Script/Dotnet.Script.csproj

Copy file name to clipboardExpand all lines: src/Dotnet.Script/Dotnet.Script.csproj
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Dotnet CLI tool allowing you to run C# (CSX) scripts.</Description>
4-
<VersionPrefix>0.27.1</VersionPrefix>
4+
<VersionPrefix>0.28.0</VersionPrefix>
55
<Authors>filipw</Authors>
66
<PackageId>Dotnet.Script</PackageId>
77
<TargetFramework>netcoreapp2.1</TargetFramework>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.