Add ReadKey to IConsole (#111)

Co-authored-by: Alexey Golub <tyrrrrrr@gmail.com>
This commit is contained in:
Alex Rosenfeld
2021-07-23 14:46:00 -04:00
committed by GitHub
parent 6c96e9e173
commit f0cbc46df4
3 changed files with 18 additions and 5 deletions

View File

@@ -84,13 +84,18 @@ namespace CliFx.Infrastructure
_cancellationTokenSource.Cancel();
}
}
/// <inheritdoc />
public void Clear()
{
}
/// <inheritdoc />
public void ReadKey(bool intercept = false)
{
}
/// <inheritdoc />
public virtual void Dispose() => _cancellationTokenSource.Dispose();
}
}
}

View File

@@ -87,6 +87,11 @@ namespace CliFx.Infrastructure
/// Clears the console buffer and corresponding console window of display information.
/// </summary>
void Clear();
/// <summary>
/// Obtains the next character or function key pressed by the user.
/// </summary>
void ReadKey(bool intercept = false);
}
/// <summary>
@@ -131,4 +136,4 @@ namespace CliFx.Infrastructure
console.WithBackgroundColor(backgroundColor)
);
}
}
}

View File

@@ -89,10 +89,13 @@ namespace CliFx.Infrastructure
return (_cancellationTokenSource = cts).Token;
}
/// <inheritdoc />
public void Clear() => Console.Clear();
/// <inheritdoc />
public void ReadKey(bool intercept = false) => Console.ReadKey(intercept);
/// <inheritdoc />
public void Dispose()
{
@@ -103,4 +106,4 @@ namespace CliFx.Infrastructure
Error.Dispose();
}
}
}
}