Cleaning up build process
This commit is contained in:
parent
7f67201bb2
commit
1b6f0ee277
4
MycroForge.Package.PluginTemplate/.gitignore
vendored
Normal file
4
MycroForge.Package.PluginTemplate/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
templates/
|
||||||
|
!templates/.gitkeep
|
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cp -R ../MycroForge.PluginTemplate templates/MycroForge.PluginTemplate
|
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json.schemastore.org/template",
|
|
||||||
"author": "Donné Napo",
|
|
||||||
"defaultName": "My.Plugin",
|
|
||||||
"name": "MycroForge plugin template",
|
|
||||||
"description": "Creates a basic MycroForge plugin project",
|
|
||||||
"projectURL": "https://github.com/mdnapo/mycroforge",
|
|
||||||
"repository": {
|
|
||||||
"url": "https://github.com/",
|
|
||||||
"type": "GitHub"
|
|
||||||
},
|
|
||||||
"classifications": ["Console","Plugin"],
|
|
||||||
"identity": "MycroForge.PluginTemplate",
|
|
||||||
"shortName": "m4gp",
|
|
||||||
"sourceName": "MycroForge.PluginTemplate",
|
|
||||||
"tags": {
|
|
||||||
"language": "C#",
|
|
||||||
"type": "project"
|
|
||||||
},
|
|
||||||
"preferNameDirectory": true
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.CommandLine;
|
|
||||||
using MycroForge.Core;
|
|
||||||
using MycroForge.Core.Contract;
|
|
||||||
using RootCommand = MycroForge.Core.RootCommand;
|
|
||||||
|
|
||||||
namespace MycroForge.PluginTemplate;
|
|
||||||
|
|
||||||
public class HelloWorldCommand : Command, ISubCommandOf<RootCommand>
|
|
||||||
{
|
|
||||||
private readonly Argument<string> NameArgument =
|
|
||||||
new(name: "name", description: "The name of the person to greet");
|
|
||||||
|
|
||||||
private readonly Option<bool> AllCapsOption =
|
|
||||||
new(aliases: ["-a", "--all-caps"], description: "Print the name in all caps");
|
|
||||||
|
|
||||||
private readonly ProjectContext _context;
|
|
||||||
|
|
||||||
public HelloWorldCommand(ProjectContext context) :
|
|
||||||
base("hello", "An example command generated by dotnet new using the m4gp template")
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
AddArgument(NameArgument);
|
|
||||||
AddOption(AllCapsOption);
|
|
||||||
this.SetHandler(ExecuteAsync, NameArgument, AllCapsOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ExecuteAsync(string name, bool allCaps)
|
|
||||||
{
|
|
||||||
name = allCaps ? name.ToUpper() : name;
|
|
||||||
|
|
||||||
await _context.CreateFile("hello_world.txt",
|
|
||||||
$"Hello {name}!",
|
|
||||||
"This file was generated by your custom command!"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using MycroForge.Core.Contract;
|
|
||||||
using RootCommand = MycroForge.Core.RootCommand;
|
|
||||||
|
|
||||||
namespace MycroForge.PluginTemplate;
|
|
||||||
|
|
||||||
public class HelloWorldCommandPlugin : ICommandPlugin
|
|
||||||
{
|
|
||||||
public string Name => "MycroForge.PluginTemplate";
|
|
||||||
|
|
||||||
public void RegisterServices(IServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddScoped<ISubCommandOf<RootCommand>, HelloWorldCommand>();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include=".template.config\template.json" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="MycroForge.Core" Version="1.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
Loading…
Reference in New Issue
Block a user