mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-24 04:02:50 +08:00

If the user's environment didn't support unicode, we used to fall back to using the AsciiTreeGuide if LineTreeGuide was being used (which it is by default). This commit removes that fallback since the characters used in LineTreeGuide is covered by extended ASCII, which SHOULD be fine in almost all scenarios. Closes #324
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
namespace Spectre.Console.Examples
|
|
{
|
|
public static class Program
|
|
{
|
|
public static void Main()
|
|
{
|
|
AnsiConsole.WriteLine();
|
|
|
|
// Render the tree
|
|
var tree = BuildTree();
|
|
AnsiConsole.Render(tree);
|
|
}
|
|
|
|
private static Tree BuildTree()
|
|
{
|
|
// Create the tree
|
|
var tree = new Tree("Root")
|
|
.Style(Style.Parse("red"))
|
|
.Guide(TreeGuide.Line);
|
|
|
|
// Add some nodes
|
|
var foo = tree.AddNode("[yellow]Foo[/]");
|
|
var table = foo.AddNode(new Table()
|
|
.RoundedBorder()
|
|
.AddColumn("First")
|
|
.AddColumn("Second")
|
|
.AddRow("1", "2")
|
|
.AddRow("3", "4")
|
|
.AddRow("5", "6"));
|
|
|
|
table.AddNode("[blue]Baz[/]");
|
|
foo.AddNode("Qux");
|
|
|
|
var bar = tree.AddNode("[yellow]Bar[/]");
|
|
bar.AddNode(new Calendar(2020, 12)
|
|
.AddCalendarEvent(2020, 12, 12)
|
|
.HideHeader());
|
|
|
|
// Return the tree
|
|
return tree;
|
|
}
|
|
}
|
|
}
|