Index: src/java/lucli/Lucli.java =================================================================== --- src/java/lucli/Lucli.java (revision 892706) +++ src/java/lucli/Lucli.java (working copy) @@ -66,12 +66,12 @@ boolean enableReadline; //false: use plain java. True: shared library readline /** - Main entry point. The first argument can be a filename with an - application initialization file. + Main entry point. An optional first argument can be a path to the index to use */ public Lucli(String[] args) throws IOException { String line; + String index; historyFile = System.getProperty("user.home") + File.separator + HISTORYFILE; @@ -90,9 +90,6 @@ addCommand("explain", EXPLAIN, "Explanation that describes how the document scored against query. Example: explain foo", 1); addCommand("analyzer", ANALYZER, "Specifies the Analyzer class to be used. Example: analyzer org.apache.lucene.analysis.SimpleAnalyzer", 1); - //parse command line arguments - parseArgs(args); - ConsoleReader cr = new ConsoleReader(); //Readline.readHistoryFile(fullPath); cr.setHistory(new History(new File(historyFile))); @@ -104,8 +101,15 @@ }; cr.addCompletor (new ArgumentCompletor(comp)); + //parse command line arguments + if (args.length > 0){ + index = args[0]; + } else { + index = DEFAULT_INDEX; + } + // main input loop - luceneMethods = new LuceneMethods(DEFAULT_INDEX); + luceneMethods = new LuceneMethods(index); while (true) { try { line = cr.readLine("lucli> "); @@ -282,16 +286,6 @@ System.out.println(text); } - /* - * Parse command line arguments (currently none) - */ - private void parseArgs(String[] args) { - if (args.length > 0) { - usage(); - System.exit(1); - } - } - private void usage() { message("Usage: lucli.Lucli"); message("(currently, no parameters are supported)"); Index: run.sh =================================================================== --- run.sh (revision 892706) +++ run.sh (working copy) @@ -19,4 +19,4 @@ #JAVA_HOME=/home/dror/j2sdk1.4.1_03/ CLASSPATH=${CLASSPATH}:$LUCLI/lib/jline.jar:$LUCLI/lib/lucene.jar:$LUCLI/dist/lucli-dev.jar export CLASSPATH -$JAVA_HOME/bin/java -Xmx${LUCLI_MEMORY} lucli.Lucli +$JAVA_HOME/bin/java -Xmx${LUCLI_MEMORY} lucli.Lucli $1