-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved SRC and Test folders to root directory.
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
Showing
23 changed files
with
618 additions
and
584 deletions.
There are no files selected for viewing
Binary file not shown.
56 changes: 28 additions & 28 deletions
56
src/ReadLine.Demo/AutoCompleteHandler.cs → ReadLine.Demo/AutoCompleteHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
62
src/ReadLine.Demo/Program.cs → ReadLine.Demo/Program.cs
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
30
src/ReadLine.Demo/ReadLine.Demo.csproj → ReadLine.Demo/ReadLine.Demo.csproj
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.