feat: 完成模板从gitee上获取

This commit is contained in:
chenchun
2024-11-07 17:35:22 +08:00
parent ed5c20c612
commit d5ca8ddf1e
15 changed files with 192 additions and 61 deletions

View File

@@ -26,13 +26,34 @@ namespace Yi.Abp.Tool.Commands
public void CommandLineApplication(CommandLineApplication application)
{
var templateTypeOption = application.Option("-t|--moduleType", "模板类型:`module`|`porject`",
var templateTypeOption = application.Option("-t|--template", "模板类型:`module`|`porject`",
CommandOptionType.SingleValue);
var pathOption = application.Option("-p|--path", "创建路径", CommandOptionType.SingleValue);
var csfOption = application.Option("-csf", "是否创建解决方案文件夹", CommandOptionType.NoValue);
var soureOption = application.Option("-s|--soure", "模板来源gitee模板库分支名称: 默认值`defualt`",
CommandOptionType.SingleValue);
var moduleNameArgument = application.Argument("moduleName", "模块名", (_) => { });
//子命令new list
application.Command("list",(applicationlist) =>
{
applicationlist.OnExecute(() =>
{
Console.WriteLine("正在远程搜索中...");
var list=_templateGenService.GetAllTemplatesAsync().Result;
var tip = $"""
全部模板包括:
模板名称
----------------
{list.JoinAsString("\n")}
""";
Console.WriteLine(tip);
return 0;
});
});
application.OnExecute(() =>
{
#region
@@ -41,6 +62,8 @@ namespace Yi.Abp.Tool.Commands
var zipPath = string.Empty;
byte[] fileByteArray;
var soure= soureOption.HasValue() ? soureOption.Value() : "defualt";
var templateType = templateTypeOption.HasValue() ? templateTypeOption.Value() : "module";
if (templateType == "module")
{
@@ -48,12 +71,13 @@ namespace Yi.Abp.Tool.Commands
fileByteArray = (_templateGenService.CreateModuleAsync(new TemplateGenCreateInputDto
{
Name = moduleNameArgument.Value,
ModuleSoure = soure
}).Result);
}
else
{
//代表模块生成
fileByteArray = _templateGenService.CreateProjectAsync(new TemplateGenCreateInputDto
//还是代表模块生成
fileByteArray = _templateGenService.CreateModuleAsync(new TemplateGenCreateInputDto
{
Name = moduleNameArgument.Value,
}).Result;

View File

@@ -13,13 +13,15 @@ class Program
//args = ["-h"];
//版本
args = ["-v"];
// args = ["-v"];
//清理
// args = ["clear"];
//创建模块
//args = ["new","oooo", "-t","module","-p","D:\\temp","-csf"];
//查看模板列表
args = ["new","list"];
//添加模块
//args = ["add-module", "kkk"];

View File

@@ -15,7 +15,8 @@ namespace Yi.Abp.Tool
Configure<AbpRemoteServiceOptions>(options =>
{
options.RemoteServices.Default =
new RemoteServiceConfiguration("https://ccnetcore.com:19009");
// new RemoteServiceConfiguration("https://ccnetcore.com:19009");
new RemoteServiceConfiguration("http://localhost:19002");
});
}
}