private void printArg(ArgSpec arg, PrintWriter pw, String indent) { pw.printf("%sdescription: %s%n", indent, Arrays.toString(arg.description())); pw.printf("%sdescriptionKey: '%s'%n", indent, arg.descriptionKey()); pw.printf("%stypeInfo: %s%n", indent, arg.typeInfo()); pw.printf("%sarity: %s%n", indent, arg.arity()); pw.printf("%ssplitRegex: '%s'%n", indent, arg.splitRegex()); pw.printf("%sinteractive: %s%n", indent, arg.interactive()); pw.printf("%srequired: %s%n", indent, arg.required()); pw.printf("%shidden: %s%n", indent, arg.hidden()); pw.printf("%shideParamSyntax: %s%n", indent, arg.hideParamSyntax()); pw.printf("%sdefaultValue: '%s'%n", indent, arg.defaultValue()); pw.printf("%sshowDefaultValue: %s%n", indent, arg.showDefaultValue()); pw.printf("%shasInitialValue: %s%n", indent, arg.hasInitialValue()); pw.printf("%sinitialValue: '%s'%n", indent, arg.initialValue()); pw.printf("%sparamLabel: '%s'%n", indent, arg.paramLabel()); pw.printf("%sconverters: %s%n", indent, Arrays.toString(arg.converters())); pw.printf("%scompletionCandidates: %s%n", indent, iter(arg.completionCandidates())); pw.printf("%sgetter: %s%n", indent, arg.getter()); pw.printf("%ssetter: %s%n", indent, arg.setter()); }
/** Returns whether the default for this option or positional parameter should be shown, potentially overriding the specified global setting. * @param usageHelpShowDefaults whether the command's UsageMessageSpec is configured to show default values. */ protected boolean internalShowDefaultValue(boolean usageHelpShowDefaults) { if (showDefaultValue() == Help.Visibility.ALWAYS) { return true; } // override global usage help setting if (showDefaultValue() == Help.Visibility.NEVER) { return false; } // override global usage help setting if (initialValue == null && defaultValue() == null) { return false; } // no default value to show return usageHelpShowDefaults && !isBoolean(type()); } /** Returns the Messages for this arg specification, or {@code null}.
/** Returns whether the default for this option or positional parameter should be shown, potentially overriding the specified global setting. * @param usageHelpShowDefaults whether the command's UsageMessageSpec is configured to show default values. */ protected boolean internalShowDefaultValue(boolean usageHelpShowDefaults) { if (showDefaultValue() == Help.Visibility.ALWAYS) { return true; } // override global usage help setting if (showDefaultValue() == Help.Visibility.NEVER) { return false; } // override global usage help setting if (initialValue == null && defaultValue() == null) { return false; } // no default value to show return usageHelpShowDefaults && !isBoolean(type()); } /** Returns the Messages for this arg specification, or {@code null}.