diff options
author | Raphael Moll <> | 2009-04-21 13:04:49 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-21 13:04:49 -0700 |
commit | 09bbeea1d75d9e96b61cd611ad327a5fac0e6672 (patch) | |
tree | 2cece1c6f3ce18a98bc84cdf339b72e75a82f8a7 /sdkmanager/app/src | |
parent | 888106073381c2497aa2d82807a3547851f347dd (diff) | |
download | sdk-09bbeea1d75d9e96b61cd611ad327a5fac0e6672.zip sdk-09bbeea1d75d9e96b61cd611ad327a5fac0e6672.tar.gz sdk-09bbeea1d75d9e96b61cd611ad327a5fac0e6672.tar.bz2 |
AI 147176: am: CL 147174 ADT #1801919: Make default options output a bit more friendly.
Original author: raphael
Merged from: //branches/cupcake/...
Automated import of CL 147176
Diffstat (limited to 'sdkmanager/app/src')
-rw-r--r-- | sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java b/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java index 9f3fb99..c20bfa4 100644 --- a/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java +++ b/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java @@ -482,22 +482,29 @@ public class CommandLineProcessor { if (arg.getVerb().equals(verb) && arg.getDirectObject().equals(directObject)) { String value = ""; - if (arg.getDefaultValue() instanceof String[]) { - for (String v : (String[]) arg.getDefaultValue()) { - if (value.length() > 0) { - value += ", "; + String required = ""; + if (arg.isMandatory()) { + required = " [required]"; + + } else { + if (arg.getDefaultValue() instanceof String[]) { + for (String v : (String[]) arg.getDefaultValue()) { + if (value.length() > 0) { + value += ", "; + } + value += v; + } + } else if (arg.getDefaultValue() != null) { + Object v = arg.getDefaultValue(); + if (arg.getMode() != MODE.BOOLEAN || v.equals(Boolean.TRUE)) { + value = v.toString(); } - value += v; } - } else if (arg.getDefaultValue() != null) { - value = arg.getDefaultValue().toString(); - } - if (value.length() > 0) { - value = " (" + value + ")"; + if (value.length() > 0) { + value = " [Default: " + value + "]"; + } } - String required = arg.isMandatory() ? " [required]" : ""; - stdout(" -%1$s %2$-10s %3$s%4$s%5$s", arg.getShortArg(), "--" + arg.getLongArg(), |