Skip to content

Commit

Permalink
Moved SRC and Test folders to root directory.
Browse files Browse the repository at this point in the history
Refactored static ReadLine class to a true singleton.
Changed unit tests to use NUnit instead of XUnit.
Fixed Ctrl+C issue #59 (Add option to return CTRL+C)
Updated version.
  • Loading branch information
Latency committed Mar 18, 2020
1 parent efef308 commit f734a8a
Show file tree
Hide file tree
Showing 23 changed files with 618 additions and 584 deletions.
Binary file added Artifacts/ReadLine.2.1.3.nupkg
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
namespace ReadLine.Demo
{
internal class AutoCompletionHandler : IAutoCompleteHandler
{
public char[] Separators { get; set; } =
{
' ',
'.',
'/',
'\\',
':'
};


public string[] GetSuggestions(string text, int index)
{
return text.StartsWith("git ")
? new[]
{
"init",
"clone",
"pull",
"push"
}
: null;
}
}
}
namespace ReadLine.Demo
{
internal class AutoCompletionHandler : IAutoCompleteHandler
{
public char[] Separators { get; set; } =
{
' ',
'.',
'/',
'\\',
':'
};


public string[] GetSuggestions(string text, int index)
{
return text.StartsWith("git ")
? new[]
{
"init",
"clone",
"pull",
"push"
}
: null;
}
}
}
62 changes: 32 additions & 30 deletions src/ReadLine.Demo/Program.cs → ReadLine.Demo/Program.cs
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
using System;


namespace ReadLine.Demo
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("ReadLine Library Demo");
Console.WriteLine("---------------------");
Console.WriteLine();

string[] history =
{
"ls -a",
"dotnet run",
"git init"
};
ReadLine.AddHistory(history);

ReadLine.AutoCompletionHandler = new AutoCompletionHandler();

var input = ReadLine.Read("(prompt)> ");
Console.WriteLine(input);

input = ReadLine.ReadPassword("Enter Password> ");
Console.WriteLine(input);
}
}
using System;


namespace ReadLine.Demo
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("ReadLine Library Demo");
Console.WriteLine("---------------------");
Console.WriteLine();

string[] history =
{
"ls -a",
"dotnet run",
"git init"
};

IReadLine readLine = ReadLine.Instance;
readLine.AddHistory(history);

readLine.AutoCompletionHandler = new AutoCompletionHandler();

var input = readLine.Read("(prompt)> ");
Console.WriteLine(input);

input = readLine.ReadPassword("Enter Password> ");
Console.WriteLine(input);
}
}
}
30 changes: 15 additions & 15 deletions src/ReadLine.Demo/ReadLine.Demo.csproj → ReadLine.Demo/ReadLine.Demo.csproj
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<DebugType>portable</DebugType>
<AssemblyName>ReadLine.Demo</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>ReadLine.Demo</PackageId>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../ReadLine/ReadLine.csproj" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<DebugType>portable</DebugType>
<AssemblyName>ReadLine.Demo</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>ReadLine.Demo</PackageId>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../ReadLine/ReadLine.csproj" />
</ItemGroup>

</Project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static class CharExtensions

public const char CtrlA = '\u0001';
public const char CtrlB = '\u0002';
public const char CtrlC = '\u0003';
public const char CtrlD = '\u0004';
public const char CtrlE = '\u0005';
public const char CtrlF = '\u0006';
Expand All @@ -29,6 +30,7 @@ public static class CharExtensions
{Space, Tuple.Create(ConsoleKey.Spacebar, NoModifiers())},
{CtrlA, Tuple.Create(ConsoleKey.A, ConsoleModifiers.Control)},
{CtrlB, Tuple.Create(ConsoleKey.B, ConsoleModifiers.Control)},
{CtrlC, Tuple.Create(ConsoleKey.C, ConsoleModifiers.Control)},
{CtrlD, Tuple.Create(ConsoleKey.D, ConsoleModifiers.Control)},
{CtrlE, Tuple.Create(ConsoleKey.E, ConsoleModifiers.Control)},
{CtrlF, Tuple.Create(ConsoleKey.F, ConsoleModifiers.Control)},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static class ConsoleKeyInfoExtensions
public static readonly ConsoleKeyInfo Space = CharExtensions.Space.ToConsoleKeyInfo();
public static readonly ConsoleKeyInfo CtrlA = CharExtensions.CtrlA.ToConsoleKeyInfo();
public static readonly ConsoleKeyInfo CtrlB = CharExtensions.CtrlB.ToConsoleKeyInfo();
public static readonly ConsoleKeyInfo CtrlC = CharExtensions.CtrlC.ToConsoleKeyInfo();
public static readonly ConsoleKeyInfo CtrlD = CharExtensions.CtrlD.ToConsoleKeyInfo();
public static readonly ConsoleKeyInfo CtrlE = CharExtensions.CtrlE.ToConsoleKeyInfo();
public static readonly ConsoleKeyInfo CtrlF = CharExtensions.CtrlF.ToConsoleKeyInfo();
Expand Down
Loading

0 comments on commit f734a8a

Please sign in to comment.