summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/Main.java4
-rw-r--r--src/main/TweetShell.java19
2 files changed, 15 insertions, 8 deletions
diff --git a/src/main/Main.java b/src/main/Main.java
index b782d89..4b02223 100644
--- a/src/main/Main.java
+++ b/src/main/Main.java
@@ -173,7 +173,9 @@ public class Main {
TweetShell shell = new TweetShell();
// pass any remaining parameters to the shell
if (params.length > 0) {
- shell.execute(params);
+ for (String cmd : params) {
+ shell.execute(cmd);
+ }
}
shell.process_forever();
break;
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java
index 818c693..d292c9a 100644
--- a/src/main/TweetShell.java
+++ b/src/main/TweetShell.java
@@ -126,19 +126,24 @@ public class TweetShell implements TwitterApi.PinSupplier {
printPrompt();
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
- String[] args = line.split("\\s+", 2);
- if (!args[0].isEmpty()) {
- // non-empty command, let's see whether it makes sense?
- if (!execute(args)) {
- // requested to terminate
- break;
- }
+ if (!execute(line)) {
+ // requested to terminate
+ break;
}
// print prompt for reading next line
printPrompt();
}
}
+ public boolean execute(String cmd) {
+ String[] args = cmd.trim().split("\\s+", 2);
+ if (!args[0].isEmpty()) {
+ // non-empty command, let's see whether it makes sense?
+ return execute(args);
+ }
+ return true;
+ }
+
/**
* Executes a command with optional parameters.
*