incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixed BLUR-353
Date Mon, 22 Jun 2015 13:45:35 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master b34c2cc5c -> fb83a74b8


Fixed BLUR-353


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/fb83a74b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/fb83a74b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/fb83a74b

Branch: refs/heads/master
Commit: fb83a74b86e866a49ddc76474a634bbe1ca9fc24
Parents: b34c2cc
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Jun 22 09:45:48 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Jun 22 09:45:48 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/shell/QueryCommand.java    | 11 +++--------
 .../java/org/apache/blur/shell/QueryCommandHelper.java   |  9 +++++----
 2 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb83a74b/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java b/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
index a7fc985..83f958a 100644
--- a/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
+++ b/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
@@ -62,10 +62,6 @@ public class QueryCommand extends Command implements TableFirstArgCommand
{
   @Override
   public void doit(PrintWriter outPw, Blur.Iface client, String[] args) throws CommandException,
TException,
       BlurException {
-    if (args.length < 3) {
-      throw new CommandException("Invalid args: " + help());
-    }
-
     try {
       doItInternal(client, args, outPw);
     } catch (FinishedException e) {
@@ -77,8 +73,7 @@ public class QueryCommand extends Command implements TableFirstArgCommand
{
 
   private void doItInternal(Blur.Iface client, String[] args, PrintWriter out) throws FinishedException,
BlurException,
       TException {
-    String tablename = args[1];
-    CommandLine commandLine = QueryCommandHelper.parse(args, out);
+    CommandLine commandLine = QueryCommandHelper.parse(args, out, name() + " " + usage());
     if (commandLine == null) {
       return;
     }
@@ -90,7 +85,7 @@ public class QueryCommand extends Command implements TableFirstArgCommand
{
     if (commandLine.hasOption(QueryCommandHelper.WIDTH)) {
       _width = Integer.parseInt(commandLine.getOptionValue(QueryCommandHelper.WIDTH));
     }
-
+    String tablename = args[1];
     long s = System.nanoTime();
     BlurResults blurResults = client.query(tablename, blurQuery);
     long e = System.nanoTime();
@@ -546,7 +541,7 @@ public class QueryCommand extends Command implements TableFirstArgCommand
{
 
   @Override
   public String usage() {
-    return "<tablename> <query> [<options>]";
+    return "<tablename> [<options>]";
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb83a74b/blur-shell/src/main/java/org/apache/blur/shell/QueryCommandHelper.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/QueryCommandHelper.java b/blur-shell/src/main/java/org/apache/blur/shell/QueryCommandHelper.java
index da3d978..72db77b 100644
--- a/blur-shell/src/main/java/org/apache/blur/shell/QueryCommandHelper.java
+++ b/blur-shell/src/main/java/org/apache/blur/shell/QueryCommandHelper.java
@@ -18,6 +18,7 @@
 
 package org.apache.blur.shell;
 
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.Writer;
 import java.util.ArrayList;
@@ -170,9 +171,9 @@ public class QueryCommandHelper {
   }
 
   @SuppressWarnings("static-access")
-  public static CommandLine parse(String[] otherArgs, Writer out) {
+  public static CommandLine parse(String[] otherArgs, Writer out, String usage) {
     Options options = new Options();
-    options.addOption(OptionBuilder.hasArgs().withDescription("Query string.").isRequired().create(QUERY));
+    options.addOption(OptionBuilder.hasArgs().withDescription("* Query string.").isRequired().create(QUERY));
     options.addOption(OptionBuilder.withDescription("Disables row query. (Enabled by default)").create(
         DISABLE_ROW_QUERY));
     options.addOption(OptionBuilder.hasArg().withArgName(SCORE_TYPE).withDescription("Specify
the scoring type.")
@@ -208,14 +209,14 @@ public class QueryCommandHelper {
       if (cmd.hasOption("h")) {
         HelpFormatter formatter = new HelpFormatter();
         PrintWriter pw = new PrintWriter(out, true);
-        formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, "query", null, options, HelpFormatter.DEFAULT_LEFT_PAD,
+        formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, usage, null, options, HelpFormatter.DEFAULT_LEFT_PAD,
             HelpFormatter.DEFAULT_DESC_PAD, null, false);
         return null;
       }
     } catch (ParseException e) {
       HelpFormatter formatter = new HelpFormatter();
       PrintWriter pw = new PrintWriter(out, true);
-      formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, "query", null, options, HelpFormatter.DEFAULT_LEFT_PAD,
+      formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, usage, null, options, HelpFormatter.DEFAULT_LEFT_PAD,
           HelpFormatter.DEFAULT_DESC_PAD, null, false);
       return null;
     }


Mime
View raw message