net.xBei.ConsoleApp 1.0.4-beta

This is a prerelease version of net.xBei.ConsoleApp.
dotnet add package net.xBei.ConsoleApp --version 1.0.4-beta
                    
NuGet\Install-Package net.xBei.ConsoleApp -Version 1.0.4-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.4-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="net.xBei.ConsoleApp" Version="1.0.4-beta" />
                    
Directory.Packages.props
<PackageReference Include="net.xBei.ConsoleApp" />
                    
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 net.xBei.ConsoleApp --version 1.0.4-beta
                    
#r "nuget: net.xBei.ConsoleApp, 1.0.4-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.
#:package net.xBei.ConsoleApp@1.0.4-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=net.xBei.ConsoleApp&version=1.0.4-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=net.xBei.ConsoleApp&version=1.0.4-beta&prerelease
                    
Install as a Cake Tool

net.xBei.ConsoleApp

命令行程序框架

更新记录

b-1.0.4

  • 支持枚举类型参数
  • 支持DateTime类型
  • 参数别名可以指定多个

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

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 125 9/17/2023
1.0.3-beta 206 9/21/2022
1.0.2-beta 219 8/12/2022