net.xBei.ConsoleApp
1.0.3-beta
This is a prerelease version of net.xBei.ConsoleApp.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package net.xBei.ConsoleApp --version 1.0.3-beta
NuGet\Install-Package net.xBei.ConsoleApp -Version 1.0.3-beta
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="net.xBei.ConsoleApp" Version="1.0.3-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add net.xBei.ConsoleApp --version 1.0.3-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: net.xBei.ConsoleApp, 1.0.3-beta"
#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 net.xBei.ConsoleApp as a Cake Addin #addin nuget:?package=net.xBei.ConsoleApp&version=1.0.3-beta&prerelease // Install net.xBei.ConsoleApp as a Cake Tool #tool nuget:?package=net.xBei.ConsoleApp&version=1.0.3-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
net.xBei.ConsoleApp
命令行程序框架
更新记录
b-1.0.3
2022-09-21
- 参数支持别名
- 子命令名称忽略大小写
用法
测试中,随时会更改代码
using net.xBei.ConsoleApp;
internal class Program {
static void Main(string[] args) {
CliApplication.Start(args,
configurationAction: (services, config) => {
if (config == null) return;
//配置程序 appsettings.json
},
servicesAction: (services, ioc, env) => {
// 注入服务
},
);
}
}
/// <summary>
/// 测试子命令,会自动注入
/// </summary>
public class TestCommand : ISubCommand {
public string Description => "测试";
public bool IsDefault => false;
public string Name => "test";
public void ShowHelp(bool showDetail, int level = 0) {
System.Console.WriteLine($"测试子命令");
}
public async Task<int> RunAsync(string[] args, CancellationToken? cancellationToken = null) {
System.Console.WriteLine($"测试");
ShowHelp(ture);
await Task.Delay(0);
return 0;
}
}
依赖
- net.xBei.Common
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.Extensions.Hosting (>= 6.0.1)
- Microsoft.Extensions.Http (>= 6.0.0)
- net.xBei.Common (>= 1.0.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.4-beta | 82 | 9/17/2023 |
1.0.3-beta | 124 | 9/21/2022 |
1.0.2-beta | 132 | 8/12/2022 |