-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGenerateCommand.cs
More file actions
29 lines (28 loc) · 924 Bytes
/
Copy pathGenerateCommand.cs
File metadata and controls
29 lines (28 loc) · 924 Bytes
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
using System.CommandLine;
using SchemaScraper.Cli;
using SchemaScraper.Services;
using SchemaScraper.Sql;
namespace SchemaScraper.Commands;
public class GenerateCommand()
: ConnectorCommand(
"generate",
"Scrape and generate schema metadata documentation in markdown format.",
new Func<string, string?, string?, string?, FileInfo, Task>(Call),
[
new Option<string?>(
aliases: ["--root", "-r"],
description: "Root directory to generate schema metadata documentation."
)
]
)
{
static async Task Call(
string? root, string? key, string? server, string? db, FileInfo connections
)
{
Connector connector = Connector.Generate(key, server, db, connections);
string path = Path.Join("..", root ?? key ?? db);
ScraperWriter writer = new(path, connector);
await writer.GenerateTables(writer.GenerateTable);
}
}