You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2011/04/07 12:13:18 UTC
svn commit: r1089801 -
/tika/trunk/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
Author: jukka
Date: Thu Apr 7 10:13:18 2011
New Revision: 1089801
URL: http://svn.apache.org/viewvc?rev=1089801&view=rev
Log:
TIKA-635: Tika GUI improvements
Start the GUI if no command line arguments were given and nothing is available on standard input.
Modified:
tika/trunk/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
Modified: tika/trunk/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java?rev=1089801&r1=1089800&r2=1089801&view=diff
==============================================================================
--- tika/trunk/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java (original)
+++ tika/trunk/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java Thu Apr 7 10:13:18 2011
@@ -87,11 +87,25 @@ public class TikaCLI {
Logger.getRootLogger().setLevel(Level.INFO);
TikaCLI cli = new TikaCLI();
- for (int i = 0; i < args.length; i++) {
- cli.process(args[i]);
- }
- if (cli.pipeMode) {
- cli.process("-");
+ if (args.length > 0) {
+ for (int i = 0; i < args.length; i++) {
+ cli.process(args[i]);
+ }
+ if (cli.pipeMode) {
+ cli.process("-");
+ }
+ } else {
+ // Started with no arguments. Wait for up to 0.1s to see if
+ // we have something waiting in standard input and use the
+ // pipe mode if we have. If no input is seen, start the GUI.
+ if (System.in.available() == 0) {
+ Thread.sleep(100);
+ }
+ if (System.in.available() > 0) {
+ cli.process("-");
+ } else {
+ cli.process("--gui");
+ }
}
}
@@ -348,7 +362,8 @@ public class TikaCLI {
out.println();
out.println(" If no file name or URL is specified (or the special");
out.println(" name \"-\" is used), then the standard input stream");
- out.println(" is parsed.");
+ out.println(" is parsed. If no arguments were given and no input");
+ out.println(" data is available, the GUI is started instead.");
out.println();
out.println("- GUI mode");
out.println();