Skip to content

Commit

Permalink
Merge pull request #2 from teocomi/test
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
teocomi authored Aug 24, 2023
2 parents 5876034 + a06dc8a commit 733e27b
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.CommandLine;
using Newtonsoft.Json.Schema.Generation;
using Newtonsoft.Json.Schema.Generation;
using Newtonsoft.Json.Serialization;
using Speckle.Newtonsoft.Json;
using System.CommandLine;


internal static class Program
Expand All @@ -22,15 +22,13 @@ internal static async Task Main(string[] args)
);
var rootCommand = new RootCommand("Count objects matching the given speckle_type");
rootCommand.AddArgument(speckleProjectDataArg);
rootCommand.AddArgument(functionInputsArg);
rootCommand.AddArgument(speckleTokenArg);
rootCommand.SetHandler(
async (speckleProjectData, functionInputs, speckleToken) =>
async (speckleProjectData, speckleToken) =>
{
await RunFunction(speckleProjectData, functionInputs, speckleToken);
await RunFunction(speckleProjectData, speckleToken);
},
speckleProjectDataArg,
functionInputsArg,
speckleTokenArg
);

Expand All @@ -50,24 +48,16 @@ internal static async Task Main(string[] args)

static async Task RunFunction(
string rawSpeckleProjectData,
string rawFunctionInputs,
string speckleToken
)
{
var speckleProjectData = JsonConvert.DeserializeObject<SpeckleProjectData>(
rawSpeckleProjectData
);
var functionInputs = JsonConvert.DeserializeObject<FunctionInputs>(
rawFunctionInputs
);
var count = await AutomateFunction.Run(
speckleProjectData,

Check warning on line 58 in Program.cs

View workflow job for this annotation

GitHub Actions / publish-automate-function-version

Possible null reference argument for parameter 'speckleProjectData' in 'Task<string> AutomateFunction.Run(SpeckleProjectData speckleProjectData, string speckleToken)'.
functionInputs,
speckleToken
);
Console.WriteLine(
$"Found {count} elements that have the type {functionInputs.SpeckleTypeToCount}"
);
}

static string GenerateFunctionInputSchema()
Expand Down

0 comments on commit 733e27b

Please sign in to comment.