feat: 支持版本号

This commit is contained in:
橙子
2024-11-06 00:05:29 +08:00
parent 49f1d1a8fa
commit ed5c20c612
4 changed files with 9 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils; using Microsoft.Extensions.CommandLineUtils;
@@ -24,7 +25,7 @@ namespace Yi.Abp.Tool
private void InitCommand() private void InitCommand()
{ {
Application.HelpOption("-h|--help"); Application.HelpOption("-h|--help");
Application.VersionOption("-v|--versions","1.0.0"); Application.VersionOption("-v|--versions", Assembly.GetExecutingAssembly().GetName().Version.ToString());
foreach (var command in _commands) foreach (var command in _commands)
{ {
CommandLineApplication childrenCommandLineApplication = new CommandLineApplication(true) CommandLineApplication childrenCommandLineApplication = new CommandLineApplication(true)

View File

@@ -79,14 +79,13 @@ namespace Yi.Abp.Tool.Commands
{ {
var moduleName = moduleNameArgument.Value.ToLower().Replace(".", "-"); var moduleName = moduleNameArgument.Value.ToLower().Replace(".", "-");
unzipDirPath = Path.Combine(path, unzipDirPath); unzipDirPath = Path.Combine(path, moduleName);
if (Directory.Exists(unzipDirPath)) if (Directory.Exists(unzipDirPath))
{ {
throw new UserFriendlyException($"文件夹[{unzipDirPath}]已存在,请删除后重试"); throw new UserFriendlyException($"文件夹[{unzipDirPath}]已存在,请删除后重试");
} }
Directory.CreateDirectory(unzipDirPath); Directory.CreateDirectory(unzipDirPath);
unzipDirPath = moduleName;
} }
#endregion #endregion

View File

@@ -1,35 +1,25 @@
using Microsoft.Extensions.DependencyInjection; using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Yi.Abp.Tool; using Yi.Abp.Tool;
class Program class Program
{ {
static async Task Main(string[] args) static async Task Main(string[] args)
{ {
#if DEBUG #if DEBUG
//args = ["v"];
//args = ["-v"];
//args = ["h"];
//args = ["-h"];
//args = [];
//args = ["12312"];
//args = ["new", "Acme.Book", "-t", "module", "-csf"];
//args = ["new", "Acme.Book", "-t", "module"];
//args = ["add-module", "Acme.Demo", "-s", "D:\\code\\csharp\\source\\Yi\\Yi.Abp.Net8", "-modulePath", "D:\\code\\csharp\\source\\Yi\\Yi.Abp.Net8\\module\\acme-demo"];
// args = ["clear", "-path", "D:\\code\\csharp\\source\\Yi\\Yi.Abp.Net8\\src"];
//帮助 //帮助
//args = ["-h"]; //args = ["-h"];
//版本 //版本
// args = ["-v"]; args = ["-v"];
//清理 //清理
// args = ["clear"]; // args = ["clear"];
//创建模块 //创建模块
args = ["new","oooo", "-t","module","-p","D:\\temp","-csf"]; //args = ["new","oooo", "-t","module","-p","D:\\temp","-csf"];
//添加模块 //添加模块
//args = ["add-module", "kkk"]; //args = ["add-module", "kkk"];

View File

@@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>1.1.0</Version> <Version>2.0.0</Version>
<Authors>橙子老哥</Authors> <Authors>橙子老哥</Authors>
<Description>yi-framework框架配套工具</Description> <Description>yi-framework框架配套工具</Description>
<PackageProjectUrl>https://ccnetcore.com</PackageProjectUrl> <PackageProjectUrl>https://ccnetcore.com</PackageProjectUrl>