Skip to content

Commit

Permalink
Remove Rename sandbox to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed May 26, 2024
1 parent a830430 commit c8c676b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 27 deletions.
30 changes: 15 additions & 15 deletions FactorioTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sandbox", "src\Sandbox\Sandbox.csproj", "{D090243D-54DC-4B91-96F8-6186D2865680}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWebApp", "src\BlazorWebApp\BlazorWebApp.csproj", "{A6F55C6B-E834-43A3-A308-BFE109079F2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "src\Benchmark\Benchmark.csproj", "{207D0EE9-2E8A-4E1A-8AF9-6841AB2B553B}"
Expand Down Expand Up @@ -51,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharp.lua", "submodules\CS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharp.lua.Launcher", "submodules\CSharp.lua\CSharp.lua.Launcher\CSharp.lua.Launcher.csproj", "{5A546BA8-1514-47DD-A850-0F8B9C2B8F79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FactorioTools.Cli", "src\FactorioTools.Cli\FactorioTools.Cli.csproj", "{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -73,18 +73,6 @@ Global
{1736C18D-D61E-45C1-BADB-290D72AC2899}.Release|x64.Build.0 = Release|Any CPU
{1736C18D-D61E-45C1-BADB-290D72AC2899}.Release|x86.ActiveCfg = Release|Any CPU
{1736C18D-D61E-45C1-BADB-290D72AC2899}.Release|x86.Build.0 = Release|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Debug|x64.ActiveCfg = Debug|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Debug|x64.Build.0 = Debug|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Debug|x86.ActiveCfg = Debug|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Debug|x86.Build.0 = Debug|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Release|Any CPU.Build.0 = Release|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Release|x64.ActiveCfg = Release|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Release|x64.Build.0 = Release|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Release|x86.ActiveCfg = Release|Any CPU
{D090243D-54DC-4B91-96F8-6186D2865680}.Release|x86.Build.0 = Release|Any CPU
{A6F55C6B-E834-43A3-A308-BFE109079F2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6F55C6B-E834-43A3-A308-BFE109079F2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6F55C6B-E834-43A3-A308-BFE109079F2A}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -217,13 +205,24 @@ Global
{5A546BA8-1514-47DD-A850-0F8B9C2B8F79}.Release|x64.Build.0 = Release|Any CPU
{5A546BA8-1514-47DD-A850-0F8B9C2B8F79}.Release|x86.ActiveCfg = Release|Any CPU
{5A546BA8-1514-47DD-A850-0F8B9C2B8F79}.Release|x86.Build.0 = Release|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Debug|x64.ActiveCfg = Debug|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Debug|x64.Build.0 = Debug|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Debug|x86.ActiveCfg = Debug|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Debug|x86.Build.0 = Debug|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Release|Any CPU.Build.0 = Release|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Release|x64.ActiveCfg = Release|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Release|x64.Build.0 = Release|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Release|x86.ActiveCfg = Release|Any CPU
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1736C18D-D61E-45C1-BADB-290D72AC2899} = {2237B275-4DF9-492E-A555-E38CE0DC0E12}
{D090243D-54DC-4B91-96F8-6186D2865680} = {2237B275-4DF9-492E-A555-E38CE0DC0E12}
{A6F55C6B-E834-43A3-A308-BFE109079F2A} = {2237B275-4DF9-492E-A555-E38CE0DC0E12}
{207D0EE9-2E8A-4E1A-8AF9-6841AB2B553B} = {2237B275-4DF9-492E-A555-E38CE0DC0E12}
{6627AC05-E61C-4DC8-814B-C75366288DA4} = {789C06F6-F79B-4A6A-AC72-13672271A808}
Expand All @@ -238,6 +237,7 @@ Global
{1C96F1C2-23C7-40C7-AA33-BB16311DFDDE} = {C941BE21-DBF2-46EA-879E-892758A3AE53}
{742421E3-AE7F-46DB-B569-5F3C5E261940} = {1C96F1C2-23C7-40C7-AA33-BB16311DFDDE}
{5A546BA8-1514-47DD-A850-0F8B9C2B8F79} = {1C96F1C2-23C7-40C7-AA33-BB16311DFDDE}
{5262CC9E-421C-4A37-AE9D-F4408CA9A78C} = {2237B275-4DF9-492E-A555-E38CE0DC0E12}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8E6A453D-7E2E-4504-B5F6-474D9AEA13B8}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<AssemblyName>Knapcode.FactorioTools.Sandbox</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FactorioTools.Serialization\FactorioTools.Serialization.csproj" />
</ItemGroup>
Expand Down
36 changes: 27 additions & 9 deletions src/Sandbox/Program.cs → src/FactorioTools.Cli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
using System.Text;
using System.CommandLine;
using Knapcode.FactorioTools.OilField;

public partial class Program
public class Program
{
private static readonly string SmallListDataPath = Path.Combine(GetRepositoryRoot(), "test", "FactorioTools.Test", "OilField", "small-list.txt");
private static readonly string BigListDataPath = Path.Combine(GetRepositoryRoot(), "test", "FactorioTools.Test", "OilField", "big-list.txt");

private static void Main(string[] args)
private static async Task Main(string[] args)
{
if (args.Length > 0 && args[0] == "normalize")
var rootCommand = new RootCommand("Factorio Tools command-line tool");

var oilFieldCommand = new Command("oil-field", "oil field related subcommands");
rootCommand.Add(oilFieldCommand);

var normalizeCommand = new Command("normalize", "normalize the small and big list");
oilFieldCommand.Add(normalizeCommand);

normalizeCommand.SetHandler(() =>
{
NormalizeBlueprints.Execute(SmallListDataPath, BigListDataPath, allowComments: true);
NormalizeBlueprints.Execute(BigListDataPath, SmallListDataPath, allowComments: false);
}
else if (args.Length > 0 && args[0] == "sample")
});

var sampleCommand = new Command("sample", "Execute the oil field planner sample");
oilFieldCommand.Add(sampleCommand);

sampleCommand.SetHandler(() =>
{
var (context, summary) = Planner.ExecuteSample();
Console.WriteLine(context.Grid.ToString());
}
else
});

var sandboxCommand = new Command("sandbox", "Execute the sandbox (random test code that you write)");
oilFieldCommand.Add(sandboxCommand);

sandboxCommand.SetHandler(() =>
{
Sandbox();
}
});

await rootCommand.InvokeAsync(args);
}

private static string GetRepositoryRoot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Sandbox": {
"commandName": "Project",
"commandLineArgs": "sample"
"commandLineArgs": "oil-field sandbox"
}
}
}
Binary file removed src/Sandbox/Comparison.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions test/FactorioTools.Test/OilField/Get-BlueprintsFromAzure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ foreach ($blob in $blobs) {
}

Write-Host "Normalizing blueprints..."
$sandboxProj = Join-Path $PSScriptRoot "../../../src/Sandbox"
dotnet run --project $sandboxProj -- normalize
$cliProj = Join-Path $PSScriptRoot "../../../src/FactorioTools.Cli"
dotnet run --project $cliProj -- oil-field normalize
Write-Host "Done."

0 comments on commit c8c676b

Please sign in to comment.