Modulight.Modules.CommandLine
0.0.7
dotnet add package Modulight.Modules.CommandLine --version 0.0.7
NuGet\Install-Package Modulight.Modules.CommandLine -Version 0.0.7
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="Modulight.Modules.CommandLine" Version="0.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Modulight.Modules.CommandLine --version 0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Modulight.Modules.CommandLine, 0.0.7"
#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.
// Install Modulight.Modules.CommandLine as a Cake Addin #addin nuget:?package=Modulight.Modules.CommandLine&version=0.0.7 // Install Modulight.Modules.CommandLine as a Cake Tool #tool nuget:?package=Modulight.Modules.CommandLine&version=0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Modulight.Modules.CommandLine
class Program
{
public static async Task Main(string[] args) => await CreateHostBuilder(args).RunConsoleAsyncWithModules();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.AddModules(builder =>
{
builder.UseCommandLineModules().AddModule<AModule>();
});
});
}
[Command]
public class LogCommand : ModuleCommand<AModule>
{
public LogCommand(AModule module) : base(module)
{
}
// Order: 0
[CommandParameter(0, Description = "Value whose logarithm is to be found.")]
public double Value { get; init; }
// Name: --base
// Short name: -b
[CommandOption("base", 'b', Description = "Logarithm base.")]
public double Base { get; init; } = 10;
protected override ValueTask ExecuteAsync(IConsole console, CancellationToken cancellationToken = default)
{
var result = Math.Log(Value, Base);
console.Output.WriteLine(result);
console.Output.WriteLine($"From Module {Module.Manifest.DisplayName}.");
return default;
}
}
[CommandFrom(typeof(LogCommand))]
public class AModule : CommandLineModule
{
public AModule(IModuleHost host) : base(host)
{
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- CliFx (>= 2.0.4)
- Microsoft.Extensions.Hosting (>= 5.0.0)
- Modulight.Modules.Core (>= 0.0.7)
- Modulight.Modules.Hosting (>= 0.0.7)
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 |
---|---|---|
0.0.7 | 458 | 5/31/2021 |
0.0.7-preview.8 | 278 | 5/30/2021 |
0.0.1 | 443 | 5/30/2021 |