MasterNeverDown.Command 1.0.0

dotnet add package MasterNeverDown.Command --version 1.0.0
                    
NuGet\Install-Package MasterNeverDown.Command -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MasterNeverDown.Command" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MasterNeverDown.Command" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MasterNeverDown.Command" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MasterNeverDown.Command --version 1.0.0
                    
#r "nuget: MasterNeverDown.Command, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MasterNeverDown.Command&version=1.0.0
                    
Install MasterNeverDown.Command as a Cake Addin
#tool nuget:?package=MasterNeverDown.Command&version=1.0.0
                    
Install MasterNeverDown.Command as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

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