We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 393d654 commit 95762e4Copy full SHA for 95762e4
src/WeihanLi.Common/Helpers/ConsoleHelper.cs
@@ -201,4 +201,21 @@ public static CommandResult PrintOutputToConsole(this CommandResult commandResul
201
202
return commandResult;
203
}
204
+
205
+ public static bool HasStandardInput()
206
+ {
207
+ return Console.IsInputRedirected && Console.In.Peek() != -1;
208
+ }
209
210
+ public static bool TryGetStandardInput([MaybeNullWhen(false)]out string input)
211
212
+ if (HasStandardInput())
213
214
+ input = Console.In.ReadToEnd();
215
+ return true;
216
217
218
+ input = null;
219
+ return false;
220
221
0 commit comments