Refactor DevTool constructors and include WebGateway in solution
This commit is contained in:
parent
29e027b918
commit
3789492de3
@ -10,27 +10,19 @@ internal sealed record MenuItem(string Display, string Value);
|
||||
public enum AppExitReason { Quit, SwitchProject }
|
||||
public sealed record AppResult(AppExitReason Reason, string? NewProjectRoot = null);
|
||||
|
||||
public sealed class App
|
||||
{
|
||||
private DevToolConfig _config;
|
||||
private string _projectRoot;
|
||||
private readonly WorkspaceConfig? _workspace;
|
||||
private readonly string? _workspaceRoot;
|
||||
|
||||
private IReadOnlyDictionary<string, BuildTarget> TargetMap =>
|
||||
_config.Targets.ToDictionary(t => t.Id, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public App(
|
||||
public sealed class App(
|
||||
DevToolConfig config,
|
||||
string projectRoot,
|
||||
WorkspaceConfig? workspace = null,
|
||||
string? workspaceRoot = null)
|
||||
{
|
||||
_config = config;
|
||||
_projectRoot = projectRoot;
|
||||
_workspace = workspace;
|
||||
_workspaceRoot = workspaceRoot;
|
||||
}
|
||||
{
|
||||
private DevToolConfig _config = config;
|
||||
private string _projectRoot = projectRoot;
|
||||
private readonly WorkspaceConfig? _workspace = workspace;
|
||||
private readonly string? _workspaceRoot = workspaceRoot;
|
||||
|
||||
private IReadOnlyDictionary<string, BuildTarget> TargetMap =>
|
||||
_config.Targets.ToDictionary(t => t.Id, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public async Task<AppResult> RunAsync()
|
||||
{
|
||||
|
||||
@ -5,16 +5,10 @@ using Spectre.Console;
|
||||
|
||||
namespace Sdt.Tui;
|
||||
|
||||
public sealed class ToolchainScreen
|
||||
public sealed class ToolchainScreen(DevToolConfig config, string projectRoot)
|
||||
{
|
||||
private readonly DevToolConfig _config;
|
||||
private readonly string _projectRoot;
|
||||
|
||||
public ToolchainScreen(DevToolConfig config, string projectRoot)
|
||||
{
|
||||
_config = config;
|
||||
_projectRoot = projectRoot;
|
||||
}
|
||||
private readonly DevToolConfig _config = config;
|
||||
private readonly string _projectRoot = projectRoot;
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
@ -208,7 +202,7 @@ public sealed class ToolchainScreen
|
||||
AnsiConsole.MarkupLine(Theme.Faint($"Post-install: {cmd}"));
|
||||
var parts = cmd.Split(' ', 2);
|
||||
var postArgs = parts.Length > 1 ? parts[1].Split(' ') : Array.Empty<string>();
|
||||
await RunLiveAsync(venvPy, ["-m", ..postArgs], _projectRoot);
|
||||
await RunLiveAsync(venvPy, ["-m", .. postArgs], _projectRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +257,7 @@ public sealed class ToolchainScreen
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
private string ResolvePythonExe(PythonToolchain py)
|
||||
private static string ResolvePythonExe(PythonToolchain py)
|
||||
{
|
||||
if (OperatingSystem.IsWindows() && !string.IsNullOrWhiteSpace(py.WindowsExecutable))
|
||||
return py.WindowsExecutable;
|
||||
|
||||
@ -3,18 +3,11 @@ using Spectre.Console;
|
||||
|
||||
namespace Sdt.Tui;
|
||||
|
||||
public sealed class WorkspaceScreen
|
||||
public sealed class WorkspaceScreen(WorkspaceConfig workspace, string workspaceRoot, string currentProjectRoot)
|
||||
{
|
||||
private readonly WorkspaceConfig _workspace;
|
||||
private readonly string _workspaceRoot;
|
||||
private readonly string _currentProjectRoot;
|
||||
|
||||
public WorkspaceScreen(WorkspaceConfig workspace, string workspaceRoot, string currentProjectRoot)
|
||||
{
|
||||
_workspace = workspace;
|
||||
_workspaceRoot = workspaceRoot;
|
||||
_currentProjectRoot = currentProjectRoot;
|
||||
}
|
||||
private readonly WorkspaceConfig _workspace = workspace;
|
||||
private readonly string _workspaceRoot = workspaceRoot;
|
||||
private readonly string _currentProjectRoot = currentProjectRoot;
|
||||
|
||||
/// <summary>
|
||||
/// Shows the project switcher. Returns the absolute path to the selected project root,
|
||||
|
||||
@ -3,4 +3,5 @@
|
||||
<Project Path="Journal.Sidecar/Journal.Sidecar.csproj" />
|
||||
<Project Path="Journal.SmokeTests/Journal.SmokeTests.csproj" />
|
||||
<Project Path="Journal.DevTool/Journal.DevTool.csproj" />
|
||||
<Project Path="Journal.WebGateway/Journal.WebGateway.csproj" />
|
||||
</Solution>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user