From 43d3ac9669dc802bd8d8c7a29e1c6af2ab02ff74 Mon Sep 17 00:00:00 2001 From: Levente Bajczi Date: Wed, 10 Jan 2024 22:53:04 +0100 Subject: [PATCH] Fixed configs with help, etc --- .../main/java/hu/bme/mit/theta/xcfa/cli/XcfaCli.kt | 13 +++++++++++++ .../mit/theta/xcfa/cli/utils/SolverRegistration.kt | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/XcfaCli.kt b/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/XcfaCli.kt index 360f0d4bcc..c8446cebd1 100644 --- a/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/XcfaCli.kt +++ b/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/XcfaCli.kt @@ -38,6 +38,9 @@ class XcfaCli(private val args: Array) { @Parameter(names = ["--config", "-c"], description = "Configuration file (CLI options will overwrite these!)") var configFile: File? = null + @Parameter(names = ["--help", "-h"], help = true) + private var help = false + @Parameter var remainingFlags: MutableList = ArrayList() @@ -79,6 +82,16 @@ class XcfaCli(private val args: Array) { exitProcess(ExitCodes.INVALID_PARAM.code) } + + if (help) { + val builder = JCommander.newBuilder().addObject(this) + for (obj in config.getObjects()) { + builder.addObject(obj) + } + builder.build().usage() + return + } + /// version if (config.outputConfig.versionInfo) { CliUtils.printVersion(System.out) diff --git a/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/utils/SolverRegistration.kt b/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/utils/SolverRegistration.kt index ff7c9ca2f4..7bb010341f 100644 --- a/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/utils/SolverRegistration.kt +++ b/subprojects/xcfa/xcfa-cli/src/main/java/hu/bme/mit/theta/xcfa/cli/utils/SolverRegistration.kt @@ -35,11 +35,11 @@ fun registerAllSolverManagers(home: String, logger: Logger) { SolverManager.closeAll() // register solver managers SolverManager.registerSolverManager(Z3SolverManager.create()) - logger.write(Logger.Level.INFO, "Registered Z3 SolverManager") + logger.write(Logger.Level.INFO, "Registered Z3 SolverManager\n") if (OsHelper.getOs() == OsHelper.OperatingSystem.LINUX) { val homePath = Path.of(home) val smtLibSolverManager: SmtLibSolverManager = SmtLibSolverManager.create(homePath, logger) SolverManager.registerSolverManager(smtLibSolverManager) - logger.write(Logger.Level.INFO, "Registered SMT-LIB SolverManager") + logger.write(Logger.Level.INFO, "Registered SMT-LIB SolverManager\n") } } \ No newline at end of file