/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
@Override public void printHelp(List<String> args) { CmdLineParser p = createParser(); if (getUsageMessage() != null) System.err.println("Usage: bees "+args.get(0)+" "+getUsageMessage()); else { System.err.print("Usage: bees "+args.get(0)+p.printExample(ExampleMode.REQUIRED)); for (OptionHandler optionHandler: p.getArguments()) { if (optionHandler.option.required()) System.err.print(" " + optionHandler.getMetaVariable(null)); else System.err.print(" [" + optionHandler.getMetaVariable(null) + "]"); } System.err.println(); } p.printUsage(System.err); }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }