From 65137f1cd9e6ba1fdd74bf2521511d73bc4bcd72 Mon Sep 17 00:00:00 2001 From: Jason Wall Date: Fri, 9 Apr 2021 09:46:57 -0400 Subject: [PATCH 1/2] allow user to override the way the prompt is written for formatting rasons --- src/ReadLine/ReadLine.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ReadLine/ReadLine.cs b/src/ReadLine/ReadLine.cs index 157cf66..a912e28 100755 --- a/src/ReadLine/ReadLine.cs +++ b/src/ReadLine/ReadLine.cs @@ -19,10 +19,11 @@ static ReadLine() public static void ClearHistory() => _history = new List(); public static bool HistoryEnabled { get; set; } public static IAutoCompleteHandler AutoCompletionHandler { private get; set; } - + public static Action WritePrompt { private get; set; } = (prompt) => Console.Write(prompt); + public static string Read(string prompt = "", string @default = "") { - Console.Write(prompt); + WritePrompt(prompt); KeyHandler keyHandler = new KeyHandler(new Console2(), _history, AutoCompletionHandler); string text = GetText(keyHandler); @@ -41,7 +42,7 @@ public static string Read(string prompt = "", string @default = "") public static string ReadPassword(string prompt = "") { - Console.Write(prompt); + WritePrompt(prompt); KeyHandler keyHandler = new KeyHandler(new Console2() { PasswordMode = true }, null, null); return GetText(keyHandler); } From 7de1ddb2c42abc1310930a9a80d1c91cc766c4fa Mon Sep 17 00:00:00 2001 From: Jason Wall Date: Fri, 9 Apr 2021 10:14:25 -0400 Subject: [PATCH 2/2] Update ReadLine.csproj --- src/ReadLine/ReadLine.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ReadLine/ReadLine.csproj b/src/ReadLine/ReadLine.csproj index d63699b..876611a 100755 --- a/src/ReadLine/ReadLine.csproj +++ b/src/ReadLine/ReadLine.csproj @@ -3,7 +3,7 @@ ReadLine A GNU-Readline like library for .NET/.NET Core - 2.0.1 + 2.0.0 Toni Solarin-Sodara netstandard2.0 portable