Fix to not show -null when missing short name argument

This commit is contained in:
Mark DePristo 2011-09-28 11:31:20 -04:00
parent 43b0c98298
commit 1e32281a15
1 changed files with 10 additions and 4 deletions

View File

@ -432,11 +432,17 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
* Returns a Pair of (main, synonym) names for argument with fullName s1 and * Returns a Pair of (main, synonym) names for argument with fullName s1 and
* shortName s2. The main is selected to be the longest of the two, provided * shortName s2. The main is selected to be the longest of the two, provided
* it doesn't exceed MAX_DISPLAY_NAME, in which case the shorter is taken. * it doesn't exceed MAX_DISPLAY_NAME, in which case the shorter is taken.
* @param s1 *
* @param s2 * @param s1 the short argument name without -, or null if not provided
* @return * @param s2 the long argument name without --, or null if not provided
* @return A pair of fully qualified names (with - or --) for the argument. The first
* element is the primary display name while the second (potentially null) is a
* synonymous name.
*/ */
Pair<String, String> displayNames(String s1, String s2) { Pair<String, String> displayNames(String s1, String s2) {
s1 = s1 == null ? null : "-" + s1;
s2 = s2 == null ? null : "--" + s2;
if ( s1 == null ) return new Pair<String, String>(s2, null); if ( s1 == null ) return new Pair<String, String>(s2, null);
if ( s2 == null ) return new Pair<String, String>(s1, null); if ( s2 == null ) return new Pair<String, String>(s1, null);
@ -510,7 +516,7 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
*/ */
protected Map<String, Object> docForArgument(FieldDoc fieldDoc, ArgumentSource source, ArgumentDefinition def) { protected Map<String, Object> docForArgument(FieldDoc fieldDoc, ArgumentSource source, ArgumentDefinition def) {
Map<String, Object> root = new HashMap<String, Object>(); Map<String, Object> root = new HashMap<String, Object>();
Pair<String, String> names = displayNames("-" + def.shortName, "--" + def.fullName); Pair<String, String> names = displayNames(def.shortName, def.fullName);
root.put("name", names.getFirst() ); root.put("name", names.getFirst() );