mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-28 06:02:49 +08:00
18 lines
430 B
C#
18 lines
430 B
C#
using System;
|
|
|
|
namespace Spectre.Console.Internal
|
|
{
|
|
internal sealed class ConsoleInput : IAnsiConsoleInput
|
|
{
|
|
public ConsoleKeyInfo ReadKey(bool intercept)
|
|
{
|
|
if (!Environment.UserInteractive)
|
|
{
|
|
throw new InvalidOperationException("Failed to read input in non-interactive mode.");
|
|
}
|
|
|
|
return System.Console.ReadKey(intercept);
|
|
}
|
|
}
|
|
}
|