diff options
Diffstat (limited to 'src/main/TweetShell.java')
-rw-r--r-- | src/main/TweetShell.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java index 231007f..354bdf9 100644 --- a/src/main/TweetShell.java +++ b/src/main/TweetShell.java @@ -126,15 +126,24 @@ public class TweetShell implements TwitterApi.PinSupplier { */ public void process_forever() { System.err.println("Entering interactive shell, type 'help' for help " - + "or 'exit' to leave."); + + "or 'exit' to leave. '.' repeats the previous interactive " + + "command."); // print prompt for reading first command printPrompt(); + String lastLine = ""; while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); + // repeat last command + if (line.equals(".")) { + line = lastLine; + } if (!execute(line)) { // requested to terminate break; } + if (!line.isEmpty()) { + lastLine = line; + } // print prompt for reading next line printPrompt(); } |