Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions TUI.Cli/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright (c) 2023-2026 ktsu-dev contributors

[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ktsu.TUI.Test")]
25 changes: 12 additions & 13 deletions TUI.Cli/SampleCLI.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) 2023-2026 ktsu-dev contributors

using ktsu.TUI.Core.Contracts;
namespace ktsu.TUI.Cli;

using ktsu.TUI.Core.Elements.Layouts;
using ktsu.TUI.Core.Elements.Primitives;
using ktsu.TUI.Core.Models;
using ktsu.TUI.Core.Services;

namespace ktsu.TUI.Cli;

/// <summary>
/// A sample CLI application demonstrating the TUI library
/// </summary>
Expand All @@ -19,34 +18,34 @@ public static class SampleCLI
public static async Task Main()
{
// Create console provider
var consoleProvider = new SpectreConsoleProvider();
SpectreConsoleProvider consoleProvider = new();

// Create application
var app = new UIApplication(consoleProvider);
UIApplication app = new(consoleProvider);

// Create a demo UI
var rootPanel = CreateDemoUI();
StackPanel rootPanel = CreateDemoUI();
app.Setup(rootPanel);

// Run the application
Console.WriteLine("Starting TUI CLI Demo. Press ESC to exit.");
await app.RunAsync();
await app.RunAsync().ConfigureAwait(false);

Console.WriteLine("TUI CLI Demo finished.");
}

private static IUIElement CreateDemoUI()
private static StackPanel CreateDemoUI()
{
// Create main container
var mainPanel = new StackPanel
StackPanel mainPanel = new()
{
Orientation = Orientation.Vertical,
Spacing = 1,
Padding = Padding.Uniform(2)
};

// Add title
var title = new BorderElement
BorderElement title = new()
{
Title = "TUI Library CLI Demo",
TitleAlignment = HorizontalAlignment.Center,
Expand All @@ -61,7 +60,7 @@ private static IUIElement CreateDemoUI()
};

// Add description
var description = new TextElement
TextElement description = new()
{
Text = "This demonstrates the TUI library's capabilities:\n" +
"• Text rendering with styling\n" +
Expand All @@ -73,10 +72,10 @@ private static IUIElement CreateDemoUI()
};

// Add instructions
var instructions = new BorderElement
BorderElement instructions = new()
{
Title = "Instructions",
BorderStyle = BorderStyle.SingleLine,
BorderStyle = BorderStyle.SingleLine,
Child = new TextElement
{
Text = "Press ESC to exit the application",
Expand Down
Loading