MasterNeverDown.Command
1.0.0
dotnet add package MasterNeverDown.Command --version 1.0.0
NuGet\Install-Package MasterNeverDown.Command -Version 1.0.0
<PackageReference Include="MasterNeverDown.Command" Version="1.0.0" />
<PackageVersion Include="MasterNeverDown.Command" Version="1.0.0" />
<PackageReference Include="MasterNeverDown.Command" />
paket add MasterNeverDown.Command --version 1.0.0
#r "nuget: MasterNeverDown.Command, 1.0.0"
#addin nuget:?package=MasterNeverDown.Command&version=1.0.0
#tool nuget:?package=MasterNeverDown.Command&version=1.0.0
MasterNeverDown Command
Overview
MasterNeverDown Command is a C# library designed to execute command-line and PowerShell commands programmatically. It provides synchronous methods to run commands and handle their output, including error handling and timeout management.
Features
- Execute command-line commands
- Execute PowerShell commands with arguments
- Handle command output and errors
- Timeout management for long-running commands
Installation
To install the library, clone the repository and include the CmdHelper.cs
file in your project.
git clone https://github.com/yourusername/MasterNeverDown.Command.git
Usage
nuget
dotnet add package MasterNeverDown.Command
Execute Command-Line Command
using MasterNeverDown.Command;
// 后续可以使用该包中的类型和方法
...
var result = CmdHelper.ExecuteCommand("echo Hello World");
if (result.Item1)
{
Console.WriteLine("Output: " + result.Item2);
}
else
{
Console.WriteLine("Error: " + result.Item2);
}
Execute PowerShell Command
var result = CmdHelper.ExecutePowershell("Get-Process", ("Name", "cmd"));
if (result.Item1)
{
Console.WriteLine("Output: " + result.Item2);
}
else
{
Console.WriteLine("Error: " + result.Item2);
}
Unit Tests
The project includes a set of unit tests to verify the functionality of the command execution methods. The tests cover various scenarios, including valid commands, invalid commands, and edge cases. To run the tests, use the following command:
dotnet test
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize this `README.md` to better fit your project's specifics and requirements.
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 was computed. 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 was computed. 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. net9.0 was computed. 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. |
-
net6.0
- Polly (>= 8.5.2)
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.0.0 | 137 | a month ago |