summaryrefslogtreecommitdiff
path: root/src/main/TweetShell.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/TweetShell.java')
-rw-r--r--src/main/TweetShell.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java
index e1bf5b3..0c6b975 100644
--- a/src/main/TweetShell.java
+++ b/src/main/TweetShell.java
@@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import mining.Stream;
@@ -149,6 +150,7 @@ public class TweetShell implements TwitterApi.PinSupplier {
add("Adds a keyword to search", 1),
del("Deletes a keyword from search", 1),
+ keywords("Display currently active keywords"),
commit("Activate the stream or apply the stream keyword changes"),
close("Close the stream"),
exit("Returns to shell"),
@@ -205,6 +207,26 @@ public class TweetShell implements TwitterApi.PinSupplier {
case del:
getStream().unwatchKeyword(params[0]);
break;
+ case keywords:
+ Set<String> active = getStream().getKeywords(true);
+ Set<String> queued = getStream().getKeywords(false);
+ System.out.println("Keywords:");
+ for (String keyword : active) {
+ System.out.print(" \"" + keyword + "\"");
+ if (!queued.contains(keyword)) {
+ System.out.println(" (will be removed)");
+ } else {
+ System.out.println();
+ }
+ }
+ queued.removeAll(active);
+ for (String keyword : queued) {
+ System.out.println(" \"" + keyword + "\" (will be added)");
+ }
+ if (!queued.equals(active)) {
+ System.out.println("To apply changes, run 'commit'");
+ }
+ break;
case commit:
getStream().commit();
break;