From db80ae2107b658923ef894adb3679ea2fe4cab63 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 2 May 2014 13:28:25 +0200 Subject: Fix enabled targets print, allow multiple args, improve help --- src/main/TweetShell.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java index 6d9edd1..12814b0 100644 --- a/src/main/TweetShell.java +++ b/src/main/TweetShell.java @@ -171,9 +171,10 @@ public class TweetShell implements TwitterApi.PinSupplier { close("Close the stream"), exit("Returns to shell"), help("Get help"), - target("Set output target: one or more of {file, shell} with optional." - + "'-' (disable) or '+' (enable) prefix. Without prefix, " - + "only that target is enabled."); + target("Show output target (no args) or set output target: one or more " + + "of {file, shell}. With a '-' or '+' prefix, that target " + + "is removed/added from the list of targets. Without prefix, " + + "all other targets get disabled."); private final String description; private final int paramCount; @@ -276,13 +277,18 @@ public class TweetShell implements TwitterApi.PinSupplier { throw new NoSuchElementException(); case target: if (params.length > 0) { + // due to limitations of shell (does not handle escapes), + // do a manualy split as we cannot have spaces in our args. + if (params.length == 1) { + params = params[0].split("\\s+"); + } configureTargets(params); } else { ClassEnabledTracker targets; targets = getPossibleTargets(); // print the names of all targets that are enabled System.out.print("Enabled targets:"); - for (String name : targets.getNames()) { + for (String name : targets.getEnabled()) { System.out.print(" " + name); } System.out.println(); -- cgit v1.2.1