Skip to content

Commit

Permalink
Merge pull request #1 from Latency/Code_Formatted
Browse files Browse the repository at this point in the history
Code formatted
  • Loading branch information
Latency authored Oct 8, 2017
2 parents bc732fe + 2f1e2ae commit ae7593b
Show file tree
Hide file tree
Showing 12 changed files with 814 additions and 721 deletions.
Binary file modified artifacts/ReadLine.1.2.1.nupkg
Binary file not shown.
51 changes: 28 additions & 23 deletions src/ReadLine.Demo/Program.cs
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);
}
}
}
}
41 changes: 22 additions & 19 deletions src/ReadLine/Abstractions/Console2.cs
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);
}
}
24 changes: 13 additions & 11 deletions src/ReadLine/Abstractions/IConsole.cs
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);
}
}
Loading

0 comments on commit ae7593b

Please sign in to comment.