Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

devantler-tech/dotnet-cli-runner

Repository files navigation

▶️ .NET CLI Runner

License Test codecov

Show/hide folder structure
.
├── .github
│   └── workflows
├── src
│   └── Devantler.CLIRunner
└── tests
    └── Devantler.CLIRunner.Tests
        └── CLITests

8 directories

A simple CLI runner, that can execute CLI commands.

🚀 Getting Started

To get started, you can install the package from NuGet.

dotnet add package Devantler.CliRunner

📝 Usage

Note

The template engine uses CLIWrap under the hood. So to learn more about the API, you can visit the above link.

To run a command, you can use the CLI class.

using Devantler.CLIRunner;

var command = new Command("echo")
  .WithArguments("Hello, World!");
var cancellationToken = CancellationToken.None;
var validation = CommandResultValidation.ZeroExitCode;
bool silent = false;

var (exitCode, result) = await CLI.RunAsync(command, cancellationToken, validation, silent);

Console.WriteLine(exitCode); // Will output 0, as the command was successful
Console.WriteLine(result); // Will output "Hello, World!", as that is what is printed to stdout

You can run all kinds of commands with this library, and it will handle the output and exit code for you, such that you can easily check if the command was successful or not.

About

A simple CLI runner, that can execute CLI commands.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages