com.beust.jcommander.Parameters.commandDescription()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中com.beust.jcommander.Parameters.commandDescription()方法的一些代码示例,展示了Parameters.commandDescription()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameters.commandDescription()方法的具体详情如下:
包路径:com.beust.jcommander.Parameters
类名称:Parameters
方法名:commandDescription

Parameters.commandDescription介绍

暂无

代码示例

代码示例来源:origin: com.beust/jcommander

/**
 * @return the description of the command.
 */
public String getCommandDescription(String commandName) {
  JCommander jc = findCommandByAlias(commandName);
  if (jc == null) {
    throw new ParameterException("Asking description for unknown command: " + commandName);
  }
  Object arg = jc.getObjects().get(0);
  Parameters p = arg.getClass().getAnnotation(Parameters.class);
  ResourceBundle bundle = null;
  String result = null;
  if (p != null) {
    result = p.commandDescription();
    String bundleName = p.resourceBundle();
    if (!"".equals(bundleName)) {
      bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
    } else {
      bundle = options.bundle;
    }
    if (bundle != null) {
      String descriptionKey = p.commandDescriptionKey();
      if (!"".equals(descriptionKey)) {
        result = getI18nString(bundle, descriptionKey, p.commandDescription());
      }
    }
  }
  return result;
}

代码示例来源:origin: org.visallo/visallo-cli

private String getDescription(Class<? extends CommandLineTool> commandLineToolClass) {
  Parameters parameters = commandLineToolClass.getAnnotation(Parameters.class);
  if (parameters == null) {
    return "";
  }
  return parameters.commandDescription();
}

代码示例来源:origin: testwhat/SmaliEx

@Nullable
  public static String getCommandDescription(@Nonnull JCommander jc) {
    Parameters parameters = jc.getObjects().get(0).getClass().getAnnotation(Parameters.class);
    if (parameters == null) {
      return null;
    }
    return parameters.commandDescription();
  }
}

代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang

/**
 * @return the description of the command.
 */
public String getCommandDescription(String commandName) {
  JCommander jc = findCommandByAlias(commandName);
  if (jc == null) {
    throw new ParameterException("Asking description for unknown command: " + commandName);
  }
  Parameters p = jc.getObjects().get(0).getClass().getAnnotation(Parameters.class);
  String result = jc.getMainParameterDescription();
  if (p != null) result = getI18nString(p.commandDescriptionKey(), p.commandDescription());
  return result;
}

代码示例来源:origin: io.ballerina.messaging/broker-cli-client

/**
 * Extract command description from the jCommander instance and append it to the StringBuilder.
 *
 * @param jCommander respective JCommander instance.
 * @param sb         StringBuilder instance.
 */
static void appendCommandDescription(JCommander jCommander, StringBuilder sb) {
  MBClientCmd selfCommand = (MBClientCmd) jCommander.getObjects().get(0);
  // if no description is provided, return from here
  if (selfCommand.getClass().getAnnotations().length == 0) {
    return;
  }
  Parameters parameters = (Parameters) selfCommand.getClass().getAnnotations()[0];
  String commandDescription = parameters.commandDescription();
  sb.append(commandDescription);
  sb.append("\n\n");
}

代码示例来源:origin: locationtech/geowave

op_json.addProperty("description", command_annotation.commandDescription());

代码示例来源:origin: locationtech/geowave

tEntry.getObject().getClass().getAnnotation(Parameters.class);
if (parameters != null) {
 builder.append(parameters.commandDescription());
} else {
 builder.append("Additional Parameters");

代码示例来源:origin: locationtech/geowave

builder.append(String.format("    %s%n", childEntry.getOperationName()));
if (p != null) {
 String description = p.commandDescription();
 builder.append(String.format("      %s%n", description));
} else {

相关文章