Unverified Commit 604144df authored by Marius Göcke's avatar Marius Göcke
Browse files

update

parent 57404e7b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2,7 +2,11 @@ from ScriptCollection.TFCPS.DotNet.TFCPS_CodeUnitSpecific_DotNet import TFCPS_Co
 
def build():

    platforms = ["win-x64", "linux-x64"]
    platforms = [
        "win-x64",
        "linux-x64",
        "osx-x64",
    ]
    tf:TFCPS_CodeUnitSpecific_DotNet_Functions=TFCPS_CodeUnitSpecific_DotNet_CLI.parse(__file__)
    tf.build(platforms, False)
    #TODO generate winget-artifact
+6 −8
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ using GRYLibrary.Core.Logging.GRYLogger;
using Error = CommandLine.Error;
using SimpleOCR.CLI.Core.Verbs;
using System;
using SimpleOCR.CLI.Core.Runner;

namespace SimpleOCR.CLI.Core.Helper
{
@@ -44,14 +45,11 @@ namespace SimpleOCR.CLI.Core.Helper
                }
                else
                {
                    ParserResult<OCRAnalysisVerb> parserResult = Parser.Default.ParseArguments<OCRAnalysisVerb>(arguments);
                    ParserResult<object> parserResult = Parser.Default.ParseArguments<DownloadOCRDataVerb, OCRAnalysisVerb>(arguments);
                    return parserResult.MapResult(
                        parsedArgument =>
                        {
                            this.VerbVisitor = new VerbVisitor();
                            return parsedArgument.Accept(this.VerbVisitor);
                        },
                        (errors) => this.HandleErrors(errors, parserResult)
                        (DownloadOCRDataVerb parsedArgument) => parsedArgument.Accept(new VerbVisitor()),
                        (OCRAnalysisVerb parsedArgument) => parsedArgument.Accept(new VerbVisitor()),
                        errors => this.HandleErrors(errors, parserResult)
                    );
                }
            }
@@ -70,7 +68,7 @@ namespace SimpleOCR.CLI.Core.Helper
            }
        }

        private int HandleErrors(IEnumerable<Error> errors, ParserResult<OCRAnalysisVerb> parserResult)
        private int HandleErrors(IEnumerable<Error> errors, ParserResult<object> parserResult)
        {
            if(errors.IsHelp())
            {
+7 −0
Original line number Diff line number Diff line
namespace SimpleOCR.CLI.Core.Misc
{
    internal class Constants
    {
        public const string EnvVariableNameForDataFolder="SimpleOCRDataFolder";
    }
}
+27 −0
Original line number Diff line number Diff line
using System;

namespace SimpleOCR.CLI.Core.Misc
{
    internal static class Utilities
    {
        internal static string GetTargetFolder(string? targetFolder)
        {
            if(string.IsNullOrEmpty(targetFolder))
            {
                string? envVarValue = Environment.GetEnvironmentVariable(Constants.EnvVariableNameForDataFolder);
                if(string.IsNullOrEmpty(envVarValue))
                {
                    throw new Exception("Datafolder not set.");
                }
                else
                {
                    return envVarValue;
                }
            }
            else
            {
                return targetFolder;
            }
        }
    }
}
+8 −0
Original line number Diff line number Diff line
{
  "profiles": {
    "SimpleOCRCLI": {
      "commandName": "Project",
      //"commandLineArgs": "DownloadOCRDataVerb",
    }
  }
}
 No newline at end of file
Loading