Larcanum.ShellToolkit
1.3.0-beta.3
See the version list below for details.
dotnet add package Larcanum.ShellToolkit --version 1.3.0-beta.3
NuGet\Install-Package Larcanum.ShellToolkit -Version 1.3.0-beta.3
<PackageReference Include="Larcanum.ShellToolkit" Version="1.3.0-beta.3" />
<PackageVersion Include="Larcanum.ShellToolkit" Version="1.3.0-beta.3" />
<PackageReference Include="Larcanum.ShellToolkit" />
paket add Larcanum.ShellToolkit --version 1.3.0-beta.3
#r "nuget: Larcanum.ShellToolkit, 1.3.0-beta.3"
#:package Larcanum.ShellToolkit@1.3.0-beta.3
#addin nuget:?package=Larcanum.ShellToolkit&version=1.3.0-beta.3&prerelease
#tool nuget:?package=Larcanum.ShellToolkit&version=1.3.0-beta.3&prerelease
ShellToolkit
The goal of this library is to provide a set of tools to start and interact with processes on the host system in a way that is similarly easy to use as Bash or oder shells. First and foremost this means providing a convenient API on top of the rather crusty and awkward System.Diagnostics.Process and System.Diagnostics.ProcessStartInfo. On top of that, the library provides methods for building pipelines of commands similar to how pipes work in Bash.
One common use case and the reason for creating this library is the creation of custom .NET command line tools that rely on other programs like git, 7z, dotnet, jq, sed, awk, etc. to avoid reinventing the wheel.
Examples
The examples here are assuming that the following command line tools are available in your system PATH
Capturing and Processing simple Command Output
var runner = CommandRunner.Create();
var version = Version.Parse((await runner.CaptureAsync(Command.Create("dotnet", ["--version"]))).Output!);
// version.Major = 8
// version.Minor = 0
// version.Build = 200
Running Command Output through Filters and into a File
var runner = CommandRunner.Create();
var tempFile = new FileInfo(Path.GetTempFileName());
var pipeline = Command.Create("dotnet", ["list", @"C:\path\to\ShellToolkit.csproj", "package", "--format", "json"])
.Pipe(Command.Create("jq", [".projects.[].frameworks.[].topLevelPackages.[].id"]))
.Pipe(tempFile);
if (await runner.ExecAsync(pipeline) != 0)
{
throw new Exception("Pipeline failed");
}
var result = await File.ReadAllTextAsync(tempFile.FullName);
// result = "Microsoft.Extensions.Logging.Abstractions"
ShellToolkit.Terminal
This is a supplemental library for creating CLI programs based on the System.CommandLine library from Microsoft.
Up until beta4 of that library in 2022, it came with a set of additional libraries to deal with common tasks for CLI programs like output rendering, argument binding, etc. Starting with beta5 in Summer of 2025, all of these additional libraries were deprecated and it is now up to other parties to help with that.
This is what ShellToolkit.Terminal aims to do. Specifically, this library deals with these pain points of non-trivial CLI tools:
- Rendering colored output to the terminal and providing an injectable logger abstraction
- Based on
Microsoft.Extensions.Logging
- Based on
- Configuration management and dependency injection with an object-oriented command abstraction
- Based on
Microsoft.Extensions.ConfigurationandMicrosoft.Extensions.DependencyInjection
- Based on
- Strongly typed binding to command arguments with simple classes
TODO: Details and examples
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.1 | 166 | 11/22/2025 |
| 1.3.0 | 171 | 11/1/2025 |
| 1.3.0-beta.3 | 124 | 10/26/2025 |
| 1.3.0-beta.2 | 119 | 10/26/2025 |
| 1.3.0-beta.1 | 120 | 10/26/2025 |
| 1.2.1 | 425 | 8/30/2025 |
| 1.2.0 | 1,069 | 1/19/2025 |
| 1.1.1 | 150 | 1/5/2025 |
| 1.1.1-rc2 | 128 | 1/5/2025 |
| 1.1.1-rc1 | 136 | 1/5/2025 |
| 1.1.0 | 167 | 1/1/2025 |
| 1.0.2 | 595 | 8/29/2024 |
| 1.0.1 | 166 | 8/29/2024 |
| 1.0.0 | 154 | 8/29/2024 |