Skip to content
Snippets Groups Projects
Commit d60c518a authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Some pretty printing improvements for options

parent 522d4c5e
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,7 @@ abstract class LeonOptionDef[+A] {
else s"--$name=$usageRhs"
}
def helpString = {
val (hd :: tl) = description.split("\n").toList
(f"$usageDesc%-21s $hd" :: ( tl map (" " * 22 + _))).mkString("\n")
f"$usageDesc%-22s" + description.replaceAll("\n", "\n" + " " * 22)
}
private def parseValue(s: String)(implicit reporter: Reporter): A = {
......
......@@ -51,6 +51,7 @@ object Main {
lazy val allOptions: Set[LeonOptionDef[Any]] = allComponents.flatMap(_.definedOptions)
def displayHelp(reporter: Reporter, error: Boolean) = {
reporter.info("Top-level options:")
reporter.info("")
for (opt <- (MainComponent.definedOptions ++ SharedOptions.definedOptions).toSeq.sortBy(_.name)) {
......@@ -70,6 +71,11 @@ object Main {
exit(error)
}
def displayVersion(reporter: Reporter) = {
reporter.info("Leon verification and synthesis tool (http://leon.epfl.ch/)")
reporter.info("")
}
private def exit(error: Boolean) = sys.exit(if (error) 1 else 0)
def processOptions(args: Seq[String]): LeonContext = {
......@@ -133,6 +139,7 @@ object Main {
val verifyF = ctx.findOptionOrDefault(optVerify)
if (helpF) {
displayVersion(ctx.reporter)
displayHelp(ctx.reporter, error = false)
} else {
val pipeBegin: Pipeline[List[String], Program] =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment