From d00a8b9d18fdd7ca3170bf53e810e5e37246fa7b Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 29 Mar 2011 12:54:54 -0400 Subject: [PATCH] Use a parser action to show version and quit --- Tools/nib2cib/main.j | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Tools/nib2cib/main.j b/Tools/nib2cib/main.j index dc828137a..03e7ff726 100644 --- a/Tools/nib2cib/main.j +++ b/Tools/nib2cib/main.j @@ -140,7 +140,7 @@ function parseOptions(args) .help("No output"); parser.option("--version", "showVersion") - .set(true) + .action(printVersionAndExit) .help("Show the version of nib2cib and quit"); parser.helpful(); @@ -161,11 +161,8 @@ function parseOptions(args) else CPLogRegister(CPLogPrint, null, logFormatter); - if (options.showVersion || (!options.quiet && options.verbose > 0)) - printVersion(options.showVersion); - - if (options.showVersion) - OS.exit(0); + if (!options.quiet && options.verbose > 0) + printVersion(); return options; } @@ -392,7 +389,13 @@ function setSystemFontAndSize(configFile, inputFile) return configPath; } -function printVersion(exitAfter) +function printVersionAndExit() +{ + printVersion(); + OS.exit(0); +} + +function printVersion() { /* There are two usual possibilities for the location of the nib2cib binary. @@ -431,9 +434,6 @@ function printVersion(exitAfter) if (!version) print(""); - - if (exitAfter) - OS.exit(0); } function fail(message)