Lesson 1.5: Setting up Dependency Injection Components

Spectre.Console supports the ability to use dependency injection to find types for our commands. The library has an integration mechanism so that developers can use their favorite DI engine with their command-line app. In this lesson, we will learn how to integrate the .NET Extensions dependency injection engine with Spectre.Console. If you are unfamiliar with … Continue reading Lesson 1.5: Setting up Dependency Injection Components

Lesson 1.4: Async Commands

To this point, we have been using synchronous commands, but the Spectre.Console.Cli library also supports asynchronous commands. For anyone familiar with the async/await concepts in .NET, these commands follow the same pattern. When our commands use asynchronous APIs (for file I/O or web service calls), then we also need our commands to be asynchronous. With … Continue reading Lesson 1.4: Async Commands

CLI Lessons Updated to Spectre.Console v0.36

With the changes to merge the Spectre.Cli and Spectre.Console packages, we had to update our existing lessons to the new combined package as well. Starting with Spectre.Console v0.36, both code bases are in a single package. Our tutorial lessons have also been updated to the new version. Lesson 1.1: Starting with Spectre.Console.CliLesson 1.2: Multiple, Default, … Continue reading CLI Lessons Updated to Spectre.Console v0.36

Spectre.Cli Moved to Spectre.Console

There has been a big change to the Spectre.Cli project that I'm using in the CLI Lesson series. The project and package has moved into the Spectre.Console project. This combines the code for building command-line interface apps with the Spectre.Console capabilities to create rich, modern console UI with color, layout, and controls. While this is … Continue reading Spectre.Cli Moved to Spectre.Console

Lesson 1.2: Multiple, Default, and Hidden Commands

Having one command, like we did in our first lesson, is useful but limited. With Spectre.Console.Cli, we can define multiple commands, each with their own arguments and options, and each getting called when the user specifies that command in the command-line arguments. So let's take a look at defining multiple commands and a default command … Continue reading Lesson 1.2: Multiple, Default, and Hidden Commands

Lesson 1.1: Starting with Spectre.Console.Cli

I've been writing a lot of command-line apps to try out .NET Core and now .NET 5. There's always a lot of repeated code to setup the application, parse the command-line arguments, and then map those to operations performed by the program. I started researching some frameworks for building command-line interfaces (CLI) and there are … Continue reading Lesson 1.1: Starting with Spectre.Console.Cli