Skip to content

Add some AnsiConsole extensions and string manipulation. Support throwing CliCommandAbortException while constructing commands#77

Merged
darthsharp merged 7 commits intomainfrom
feature/smallexttocli
Feb 1, 2026
Merged

Add some AnsiConsole extensions and string manipulation. Support throwing CliCommandAbortException while constructing commands#77
darthsharp merged 7 commits intomainfrom
feature/smallexttocli

Conversation

@darthsharp
Copy link
Copy Markdown
Contributor

No description provided.

…ntroduce `AnsiConsoleStringExtensions` for string markup utilities.
… add nullability attributes, and update `DemoCliCommand` usage.
…mandAbortException` processing through a dedicated method.
…ons for `CliCommandAbortException` and add test for abort scenarios.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds convenience extension methods for working with Spectre.Console's AnsiConsole, including string markup helpers and multi-line writing methods. It also enhances error handling in the CLI framework by supporting CliCommandAbortException when thrown during command construction.

Changes:

  • Added AnsiConsoleStringExtensions with markup helper methods for common colors and styles (red, green, yellow, blue, bold, italic, etc.)
  • Added WriteLines and MarkupLines methods to AnsiConsoleExtensions for writing multiple lines at once
  • Modified DefaultCliHost to catch and handle CliCommandAbortException thrown during command construction
  • Updated sample app to demonstrate the new WriteLines functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleStringExtensions.cs New file with string extension methods for creating Spectre.Console markup
source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleExtensions.cs Added WriteLines and MarkupLines methods for writing multiple lines to console
source/Cli/CreativeCoders.Cli.Hosting/DefaultCliHost.cs Added handling for CliCommandAbortException during command construction, refactored duplicate abort handling code
tests/CreativeCoders.Cli.Tests/Hosting/DefaultCliHostTests.cs Added test to verify CliCommandAbortException handling during command construction
samples/CliHostSampleApp/DemoCliCommand.cs Updated to demonstrate new WriteLines extension method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleExtensions.cs Outdated
Comment thread samples/CliHostSampleApp/DemoCliCommand.cs
Comment thread source/Cli/CreativeCoders.Cli.Hosting/DefaultCliHost.cs Outdated
Comment thread source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleExtensions.cs Outdated
Comment thread source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleExtensions.cs Outdated
Comment thread source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleExtensions.cs Outdated
Comment thread source/SysConsole/CreativeCoders.SysConsole.Core/AnsiConsoleExtensions.cs Outdated
…improved `CliCommandAbortException` handling.
…g[]` instead of `params IEnumerable<string>` for improved usability.
@darthsharp darthsharp merged commit 2436f63 into main Feb 1, 2026
6 checks passed
@darthsharp darthsharp deleted the feature/smallexttocli branch February 1, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants