Lessons – Command-Line Interface

Over the last few years, the command-line interface (CLI) has made quite a resurgence… harkening back to the day of command prompts and running in DOS. But today the CLIs are powerful tools to build our software and control integrations with our favorite cloud providers. And there are been great advances in frameworks for building rich, beautiful command-line apps that run on any platform.

The source code for these lessons can be found in the following repository: https://dev.azure.com/d20Tek/Tutorials/_git/command-line-tutorial


Chapter 1: Getting Started

This chapter looks at the core concepts of building command line interfaces with the Spectre.Console package. We will review the core concepts while building to a working sample.

Lesson 1.1: Starting with Spectre.Console.Cli
Introductory information about command-line interface frameworks and Spectre.Console.Cli in particular. Along with the HelloWorld for this CLI app.

Lesson 1.2: Multiple, Default, and Hidden Commands
Learn to build more complex command-line apps with multiple commands for control flow, default commands, and how to configure public and private commands.

Lesson 1.3: Nested Commands
Learn to build nested commands to enable command/sub-commands structures, and learn about defining required arguments.

Lesson 1.4: Async Commands
Learn to create and configure asynchronous commands and change the Main method to also be async.

Lesson 1.5: Setting Up Dependency Injection Components
Build integration components to use Microsoft.Extensions.DependencyInjection with Spectre.Console app.

Lesson 1.6: Using Dependency Injection [coming soon…]

Lesson 1.7 Unit Testing Commands


Please provide any feedback you have about the tutorial and individual lessons.