-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
46 lines (36 loc) · 1.42 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Humanizer;
using Polyrific.Catapult.TaskProviders.Core;
namespace Polyrific.Catapult.TaskProviders.Angular
{
class Program : CodeGeneratorProvider
{
private readonly CodeGenerator _codeGenerator;
public Program(string[] args) : base(args)
{
_codeGenerator = new CodeGenerator(Logger);
}
public override string Name => "Polyrific.Catapult.TaskProviders.Angular";
static async Task Main(string[] args)
{
var app = new Program(args);
var result = await app.Execute();
app.ReturnOutput(result);
}
public override async Task<(string outputLocation, Dictionary<string, string> outputValues, string errorMessage)> Generate()
{
string projectTitle = ProjectName.Humanize(); // set the default title to project name
if (AdditionalConfigs != null && AdditionalConfigs.ContainsKey("Title") && !string.IsNullOrEmpty(AdditionalConfigs["Title"]))
projectTitle = AdditionalConfigs["Title"];
Config.OutputLocation = Config.OutputLocation ?? Config.WorkingLocation;
var error = await _codeGenerator.Generate(ProjectName, projectTitle, Config.OutputLocation, Models);
if (!string.IsNullOrEmpty(error))
return ("", null, error);
return (Config.OutputLocation, null, "");
}
}
}