1ac972f02a
* first pass of CLI ifc converter * some updates * closer * yarn works * can execute ifc? * change exe * remove extra venv needs * invocation works * fixed dockerfile and url * refactor(fileimport): temp results path should not be hardcoded in parsers * update importer to output stuff * fix up argments * remove dead code * adjust dockerfile to have tini and workdir better * fix node to a specific version * Add shell statement and pin yarn version * add ifc converter c# to ignore * merge fix * move ifc c# * fix the api usage * update the importer to new SDK * Adds a feature flag `FF_FILEIMPORT_IFC_DOTNET_ENABLED` for enabling .Net IFC parser * move directories * put back ifc js * use FF and reversions * needs token too * fix docker? * one last copy fix * adjust prettier ignore * change to enable * fix helm chart nesting * Amend healthcheck node binary path * Add FF_FILEIMPORT_IFC_DOTNET_ENABLED to feature flag parser * Allow app to write to /.config directory * fix: volume name has to be lower case * update ifc importing --------- Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com> Co-authored-by: root <root@Clynelish>
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using System.CommandLine;
|
|
using System.Text.Json;
|
|
using Speckle.Sdk.Common;
|
|
using Speckle.WebIfc.Importer;
|
|
|
|
var filePathArgument = new Argument<string>(name: "filePath");
|
|
var outputPathArgument = new Argument<string>("outputPath");
|
|
var streamIdArgument = new Argument<string>("streamId");
|
|
var commitMessageArgument = new Argument<string>("commitMessage");
|
|
var modelIdArgument = new Argument<string>("modelId");
|
|
var regionNameArgument = new Argument<string>("regionName");
|
|
|
|
var rootCommand = new RootCommand
|
|
{
|
|
filePathArgument,
|
|
outputPathArgument,
|
|
streamIdArgument,
|
|
commitMessageArgument,
|
|
modelIdArgument,
|
|
regionNameArgument,
|
|
};
|
|
rootCommand.SetHandler(
|
|
async (filePath, outputPath, streamId, commitMessage, modelId, _) =>
|
|
{
|
|
try
|
|
{
|
|
var token = Environment.GetEnvironmentVariable("USER_TOKEN").NotNull("USER_TOKEN is missing");
|
|
var url = Environment.GetEnvironmentVariable("SPECKLE_SERVER_URL") ?? "http://127.0.0.1:3000";
|
|
var commitId = await Import.Ifc(url, filePath, streamId, modelId, commitMessage, token);
|
|
File.WriteAllText(outputPath, JsonSerializer.Serialize(new { success = true, commitId }));
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
File.WriteAllText(
|
|
outputPath,
|
|
JsonSerializer.Serialize(new { success = false, error = e.ToString() })
|
|
);
|
|
}
|
|
},
|
|
filePathArgument,
|
|
outputPathArgument,
|
|
streamIdArgument,
|
|
commitMessageArgument,
|
|
modelIdArgument,
|
|
regionNameArgument
|
|
);
|
|
await rootCommand.InvokeAsync(args);
|