-
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.
Merge pull request #1 from Latency/Code_Formatted
Code formatted
- Loading branch information
Showing
12 changed files
with
814 additions
and
721 deletions.
There are no files selected for viewing
Binary file not shown.
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,30 +1,35 @@ | ||
using System; | ||
|
||
namespace ReadLine.Demo { | ||
public class Program { | ||
public static void Main(string[] args) { | ||
Console.WriteLine("ReadLine Library Demo"); | ||
Console.WriteLine("---------------------"); | ||
Console.WriteLine(); | ||
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); | ||
string[] history = | ||
{ | ||
"ls -a", | ||
"dotnet run", | ||
"git init" | ||
}; | ||
ReadLine.AddHistory(history); | ||
|
||
ReadLine.AutoCompletionHandler = (t, s) => t.StartsWith("git ") | ||
? new[] { | ||
"init", | ||
"clone", | ||
"pull", | ||
"push" | ||
} | ||
: null; | ||
ReadLine.AutoCompletionHandler = (t, s) => t.StartsWith("git ") | ||
? new[] | ||
{ | ||
"init", | ||
"clone", | ||
"pull", | ||
"push" | ||
} | ||
: null; | ||
|
||
var input = ReadLine.Read("(prompt)> "); | ||
Console.Write(input); | ||
var input = ReadLine.Read("(prompt)> "); | ||
Console.Write(input); | ||
} | ||
} | ||
} | ||
} |
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,34 @@ | ||
using System; | ||
|
||
namespace ReadLine.Abstractions { | ||
internal class Console2 : IConsole { | ||
public int CursorLeft => Console.CursorLeft; | ||
namespace ReadLine.Abstractions | ||
{ | ||
internal class Console2 : IConsole | ||
{ | ||
public bool PasswordMode { get; set; } | ||
public int CursorLeft => Console.CursorLeft; | ||
|
||
public int CursorTop => Console.CursorTop; | ||
public int CursorTop => Console.CursorTop; | ||
|
||
public int BufferWidth => Console.BufferWidth; | ||
public int BufferWidth => Console.BufferWidth; | ||
|
||
public int BufferHeight => Console.BufferHeight; | ||
public int BufferHeight => Console.BufferHeight; | ||
|
||
public bool PasswordMode { get; set; } | ||
public void SetBufferSize(int width, int height) => Console.SetBufferSize(width, height); | ||
|
||
public void SetBufferSize(int width, int height) => Console.SetBufferSize(width, height); | ||
public void SetCursorPosition(int left, int top) | ||
{ | ||
if (!PasswordMode) | ||
Console.SetCursorPosition(left, top); | ||
} | ||
|
||
public void SetCursorPosition(int left, int top) { | ||
if (!PasswordMode) | ||
Console.SetCursorPosition(left, top); | ||
} | ||
public void Write(string value) | ||
{ | ||
if (PasswordMode) | ||
value = new string(default(char), value.Length); | ||
|
||
public void Write(string value) { | ||
if (PasswordMode) | ||
value = new string(default(char), value.Length); | ||
Console.Write(value); | ||
} | ||
|
||
Console.Write(value); | ||
public void WriteLine(string value) => Console.WriteLine(value); | ||
} | ||
|
||
public void WriteLine(string value) => Console.WriteLine(value); | ||
} | ||
} |
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,12 +1,14 @@ | ||
namespace ReadLine.Abstractions { | ||
public interface IConsole { | ||
int CursorLeft { get; } | ||
int CursorTop { get; } | ||
int BufferWidth { get; } | ||
int BufferHeight { get; } | ||
void SetCursorPosition(int left, int top); | ||
void SetBufferSize(int width, int height); | ||
void Write(string value); | ||
void WriteLine(string value); | ||
} | ||
namespace ReadLine.Abstractions | ||
{ | ||
public interface IConsole | ||
{ | ||
int CursorLeft { get; } | ||
int CursorTop { get; } | ||
int BufferWidth { get; } | ||
int BufferHeight { get; } | ||
void SetCursorPosition(int left, int top); | ||
void SetBufferSize(int width, int height); | ||
void Write(string value); | ||
void WriteLine(string value); | ||
} | ||
} |
Oops, something went wrong.