AlastairLundy.CliInvoke.Specializations
2.0.0-rc.2
Prefix Reserved
This package is deprecated and is being replaced by CliInvoke.Specializations.
dotnet add package AlastairLundy.CliInvoke.Specializations --version 2.0.0-rc.2
NuGet\Install-Package AlastairLundy.CliInvoke.Specializations -Version 2.0.0-rc.2
<PackageReference Include="AlastairLundy.CliInvoke.Specializations" Version="2.0.0-rc.2" />
<PackageVersion Include="AlastairLundy.CliInvoke.Specializations" Version="2.0.0-rc.2" />
<PackageReference Include="AlastairLundy.CliInvoke.Specializations" />
paket add AlastairLundy.CliInvoke.Specializations --version 2.0.0-rc.2
#r "nuget: AlastairLundy.CliInvoke.Specializations, 2.0.0-rc.2"
#:package AlastairLundy.CliInvoke.Specializations@2.0.0-rc.2
#addin nuget:?package=AlastairLundy.CliInvoke.Specializations&version=2.0.0-rc.2&prerelease
#tool nuget:?package=AlastairLundy.CliInvoke.Specializations&version=2.0.0-rc.2&prerelease
CliInvoke.Specializations
This readme covers the CliInvoke Specializations library. Looking for the CliInvoke Readme?
Usage
CliInvoke.Specializations comes with 3 specializations as of 1.0.0:
- CmdProcessConfiguration - An easier way to execute processes and commands through cmd.exe (Only supported on Windows)
- ClassicPowershellProcessConfiguration - An easier way to execute processes and commands through Windows Powershell (Only supported on Windows)
- PowershellProcessConfiguration - An easier way to execute processes and commands through the modern Cross-Platform open source Powershell (Powershell is not installed by CliInvoke and is expected to be installed if you plan to use it.)
All Command specialization classes come with an already configured TargetFilePath that points to the relevant executable.
CmdProcessConfiguration
The CmdProcessConfiguration TargetFilePath points to Windows' copy of cmd.exe .
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessConfigurationInvoker _processConfigInvoker = serviceProvider.GetRequiredService<IProcessConfigurationInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new CmdProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
BufferedProcessResult result = await _processConfigInvoker.ExecuteBufferedAsync(processToRun);
If the result of the command being run is not of concern you can call ExecuteAsync() instead of ExecuteBufferedAsync() and ignore the returned ProcessResult like so:
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessConfigurationInvoker _processConfigInvoker = serviceProvider.GetRequiredService<IProcessConfigurationInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new CmdProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
ProcessResult result = await _processInvokerConfig.ExecuteAsync(processToRun);
ClassicPowershellProcessConfiguration
The ClassicPowershellCommand is a specialized Command class with an already configured TargetFilePath that points to Windows' copy of powershell.exe .
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessConfigurationInvoker _processConfigInvoker = serviceProvider.GetRequiredService<IProcessConfigurationInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new ClassicPowershellProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
BufferedProcessResult result = await _processConfigInvoker.ExecuteBufferedAsync(processToRun);
PowershellProcessConfiguration
The PowershellProcessConfiguration's TargetFilePath points to the installed copy of cross-platform Powershell if it is installed.
using AlastairLundy.CliInvoke.Core;
using AlastairLundy.CliInvoke.Builders;
using AlastairLundy.CliInvoke.Core.Builders;
using AlastairLundy.CliInvoke.Core.Extensibility;
using AlastairLundy.CliInvoke.Specializations.Configurations;
using AlastairLundy.CliInvoke.Specializations;
// ServiceProvider and Dependency Injection code ommitted for clarity
IProcessConfigurationInvoker _processConfigInvoker = serviceProvider.GetRequiredService<IProcessConfigurationInvoker>();
IRunnerProcessCreator _runnerProcessCreator = serviceProvider.GetRequiredService<IRunnerProcessCreator>();
//Build your command fluently
IProcessConfigurationBuilder builder = new ProcessConfigurationBuilder(
new PowershellProcessConfiguration("Your arguments go here"))
.WithWorkingDirectory(Environment.SystemDirectory);
ProcessConfiguration config = builder.Build();
ProcessConfiguration processToRun = _runnerProcessCreator.CreateRunnerProcess(config);
BufferedProcessResult result = await _processConfigInvoker.ExecuteBufferedAsync(processToRun);
Licensing
CliInvoke and CliInvoke Specializations are licensed under the MPL 2.0 license.
If you use CliInvoke or CliInvoke.Specializations in your project please make an exact copy of the contents of CliInvoke's LICENSE.txt file available either in your third party licenses txt file or as a separate txt file.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 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. net9.0 is compatible. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- AlastairLundy.CliInvoke.Core (>= 2.0.0-rc.2)
-
net8.0
- AlastairLundy.CliInvoke.Core (>= 2.0.0-rc.2)
-
net9.0
- AlastairLundy.CliInvoke.Core (>= 2.0.0-rc.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 |
|---|
## Changes since 2.0.0 RC 1
* Updated to support CliInvoke 2.0.0 RC 2
* Fixed issues regarding parameters in Specialization Configurations being passed incorrectly to the ``ProcessConfiguration`` constructor