using System;
namespace Spectre.Console
{
///
/// Represents console capabilities.
///
public sealed class Capabilities
{
private readonly Profile _profile;
///
/// Gets or sets a value indicating whether or not
/// the console supports Ansi.
///
public bool Ansi { get; set; }
///
/// Gets or sets a value indicating whether or not
/// the console support links.
///
///
/// There is probably a lot of room for improvement here
/// once we have more information about the terminal
/// we're running inside.
///
public bool Links { get; set; }
///
/// Gets or sets a value indicating whether or not
/// this is a legacy console (cmd.exe) on an OS
/// prior to Windows 10.
///
///
/// Only relevant when running on Microsoft Windows.
///
public bool Legacy { get; set; }
///
/// Gets a value indicating whether console output
/// has been redirected.
///
public bool Tty
{
get
{
if (_profile.Out.IsStandardOut())
{
return System.Console.IsOutputRedirected;
}
// Not stdout, so must be a TTY.
return true;
}
}
///
/// Gets or sets a value indicating whether
/// or not the console supports interaction.
///
public bool Interactive { get; set; }
///
/// Initializes a new instance of the class.
///
internal Capabilities(Profile profile)
{
_profile = profile ?? throw new ArgumentNullException(nameof(profile));
}
}
}