Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core
In directory sc8-pr-cvs1:/tmp/cvs-serv25987/modules/core/src/com/babeldoc/core
Modified Files:
BabeldocCommand.java
Log Message:
Added '-d' switch for dumping configuration files and contents
Index: BabeldocCommand.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/BabeldocCommand.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** BabeldocCommand.java 27 Jun 2003 02:19:57 -0000 1.12
--- BabeldocCommand.java 5 Aug 2003 14:55:41 -0000 1.13
***************
*** 66,69 ****
--- 66,74 ----
package com.babeldoc.core;
+ import java.io.BufferedReader;
+ import java.io.IOException;
+ import java.io.InputStreamReader;
+ import java.net.URL;
+
import com.babeldoc.core.config.ConfigService;
***************
*** 164,167 ****
--- 169,175 ----
setVerbose(true);
}
+ else if (commandLine.hasOption('d')) {
+ printConfigInfo();
+ }
}
***************
*** 189,192 ****
--- 197,233 ----
/**
+ * print configuration info
+ */
+ public void printConfigInfo() {
+
+ // NOTE: copied from LightConfigService.mergePropertiesFileFromUserSearchPath
+
+ // get all the 'config.properties' files that are/will be loaded
+ URL[] urls = ResourceLoader.getMatchingUrlsInSearchPath("env/config.properties",
+ EnvironmentLoader.getSearchPaths());
+
+ // display the name and contents of each config file
+ System.out.println("Showing configuration files and contents:");
+ for (int i = urls.length - 1; i >= 0; --i) {
+ URL url = urls[i];
+ System.out.println(" === " + url + " ===");
+
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
+ String line;
+ do {
+ line = reader.readLine();
+ if (line != null) {
+ System.out.println(line);
+ }
+ }
+ while (line != null);
+ } catch (IOException e) {
+ LogService.getInstance().logError(e);
+ }
+ }
+ }
+
+ /**
* setup the options on the command line.
*
***************
*** 194,200 ****
*/
public void setupCommandLine(Options options) {
! options.addOption("v", "verbose", false,
! com.babeldoc.core.I18n.get("001002"));
! options.addOption("h", "help", false, com.babeldoc.core.I18n.get("001003"));
}
--- 235,241 ----
*/
public void setupCommandLine(Options options) {
! options.addOption("v", "verbose", false, com.babeldoc.core.I18n.get("001002"));
! options.addOption("h", "help" , false, com.babeldoc.core.I18n.get("001003"));
! options.addOption("d", "debug" , false, "Write config info to stdout");
}
|