A .NET library for interacting with external command-line interfaces in C#.
Find a file
Louis Seubert d3bd04fe39
All checks were successful
default / dotnet default workflow (8.0) (push) Successful in 47s
chore: add copyright header
2024-05-10 21:49:43 +02:00
.forgejo/workflows chore: sync aux files with other repos 2024-05-10 21:48:52 +02:00
src chore: add copyright header 2024-05-10 21:49:43 +02:00
.editorconfig chore: sync aux files with other repos 2024-05-10 21:48:52 +02:00
.gitignore feat: initial project commit 2024-05-08 22:13:03 +02:00
Directory.Build.props feat: initial project commit 2024-05-08 22:13:03 +02:00
Directory.Build.targets feat: initial project commit 2024-05-08 22:13:03 +02:00
Directory.Packages.props chore: add project readme to describe the project 2024-05-10 21:41:08 +02:00
Geekeey.Extensions.Process.sln feat: initial project commit 2024-05-08 22:13:03 +02:00
global.json feat: initial project commit 2024-05-08 22:13:03 +02:00
LICENSE.md feat: initial project commit 2024-05-08 22:13:03 +02:00
nuget.config feat: initial project commit 2024-05-08 22:13:03 +02:00
README.md chore: add project readme to describe the project 2024-05-10 21:41:08 +02:00

Geekeey.Extensions.Process

Features

Getting Started

Install the NuGet package:

dotnet add package Geekeey.Extensions.Process

You may need to add our NuGet Feed to your nuget.config this can be done by adding the following lines

<packageSources>
	<add key="geekeey" value="https://git.geekeey.de/api/packages/geekeey/nuget/index.json" />
</packageSources>

Configure

The package adds a global using for the functions in the Prelude class when the ImplicitUsings is enabled in the .csproj file. This global using is recommended but can also be removed, by removing the Geekeey.Extensions.Process.Prelude value from the item group <Usings>. For more information about that see the Project.props file inside the project tree.

Usage

public static Task<int> Main()
{
	var stdout = new StringBuilder();
	var cmd = Run("git").WithArguments(["config", "--get", "user.name"]) | stdout;
	await cmd.ExecuteAsync();
	Console.WriteLine(stdout.ToString());
	return 0;
}
public static Task<int> Main()
{
	var cmd = Run("cat").WithArguments(["file.txt"]) | Run("wc");
	await cmd.ExecuteAsync();
	Console.WriteLine(stdout.ToString());
}