CmdOneLiner.NET
2.2.0
dotnet add package CmdOneLiner.NET --version 2.2.0
NuGet\Install-Package CmdOneLiner.NET -Version 2.2.0
<PackageReference Include="CmdOneLiner.NET" Version="2.2.0" />
paket add CmdOneLiner.NET --version 2.2.0
#r "nuget: CmdOneLiner.NET, 2.2.0"
// Install CmdOneLiner.NET as a Cake Addin #addin nuget:?package=CmdOneLiner.NET&version=2.2.0 // Install CmdOneLiner.NET as a Cake Tool #tool nuget:?package=CmdOneLiner.NET&version=2.2.0
CmdOneLiner.NET
CmdOneLiner.NET easily executes command-line applications from .NET in a single line of code.
Usage
Basic usage
CmdResult cmdOut = CmdOneLiner.Run("Sleeper 5", timeout: TimeSpan.FromSeconds(20));
Console.WriteLine($"Sleeper program executed in {cmdOut?.RunningFor.TotalSeconds} seconds ({cmdOut?.TotalProcessorTime?.TotalSeconds}), used {cmdOut?.MaxRamUsedBytes / 1024 / 1024} MiB of RAM, and printed to the standard output: \"{cmdOut?.StdOut}\".");
Background process + callbacks
CmdOneLiner.RunInBackground("Sleeper 5", (cmdOut) => { Console.WriteLine($"Sleeper program executed in the background in {cmdOut.RunningFor.TotalSeconds} seconds."); });
Background process + callbacks
CmdResult cmdOut = await CmdOneLiner.RunAsync("Sleeper 5");
Console.WriteLine($"Sleeper program executed asynchronously in {cmdOut.RunningFor.TotalSeconds} seconds");
Features
- Extremely easy to use.
- Multiplatform (platform agnostic).
- Measures maximum RAM usage and CPU time.
- Optional command execution timeout.
- Optional token allows cancellation from another thread.
- Can be run synchronously, asynchronously, or with a callback.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CmdOneLiner.NET:
Package | Downloads |
---|---|
Sys.IO.NG
Adds timeout, asynchronous cancellation, and Disk I/O (not CPU) Prioritization to File and Directory read/write operations on Linux. On Windows, it transparently performs File/Directory operations ignoring timeouts/cancellation/priorities (same as System.IO). It also solves Directory.Move() not working on Linux when source and destination are on different drives/mountpoints. |
|
SchrodingersStorage
An simple object-oriented file system abstraction where files and directories can be stored in one directory, two, both, or none. This is useful for accessing data while it is being transfererred between drives. |
GitHub repositories
This package is not used by any popular GitHub repositories.