/** * Subclasses can override this method to supply additional * or different options that should be part of the usage text. * Most commands will never need to do this, but the create-domain * command uses it to include the --user option as a required option. */ protected Collection<ParamModel> usageOptions() { return commandModel.getParameters(); }
/** * Subclasses can override this method to supply additional * or different options that should be part of the usage text. * Most commands will never need to do this, but the create-domain * command uses it to include the --user option as a required option. */ protected Collection<ParamModel> usageOptions() { return commandModel.getParameters(); }
/** * Get the ParamModel that corresponds to the operand * (primary parameter). Return null if none. */ private ParamModel getOperandModel() { for (ParamModel pm : commandModel.getParameters()) { if (pm.getParam().primary()) return pm; } return null; }
/** * Get the ParamModel that corresponds to the operand * (primary parameter). Return null if none. */ protected ParamModel getOperandModel() { for (ParamModel pm : commandModel.getParameters()) { if (pm.getParam().primary()) return pm; } return null; }
/** * In the usage message modify the --printprompt option to have a default * based on the --interactive option. */ protected Collection<ParamModel> usageOptions() { Collection<ParamModel> opts = commandModel.getParameters(); Set<ParamModel> uopts = new LinkedHashSet<ParamModel>(); ParamModel p = new CommandModelData.ParamModelData("printprompt", boolean.class, true, Boolean.toString(programOpts.isInteractive())); for (ParamModel pm : opts) { if (pm.getName().equals("printprompt")) uopts.add(p); else uopts.add(pm); } return uopts; }
/** * Get the ParamModel that corresponds to the operand * (primary parameter). Return null if none. */ private ParamModel getOperandModel() { for (ParamModel pm : commandModel.getParameters()) { if (pm.getParam().primary()) return pm; } return null; }
/** * Get the ParamModel that corresponds to the operand * (primary parameter). Return null if none. */ protected ParamModel getOperandModel() { for (ParamModel pm : commandModel.getParameters()) { if (pm.getParam().primary()) return pm; } return null; }
/** * Get the ParamModel that corresponds to the operand * (primary parameter). Return null if none. */ private ParamModel getOperandModel() { for (ParamModel pm : commandModel.getParameters()) { if (pm.getParam().primary()) return pm; } return null; }
/** * In the usage message modify the --printprompt option to have a * default based on the --interactive option. */ protected Collection<ParamModel> usageOptions() { Collection<ParamModel> opts = commandModel.getParameters(); Set<ParamModel> uopts = new LinkedHashSet<ParamModel>(); ParamModel p = new CommandModelData.ParamModelData("printprompt", boolean.class, true, Boolean.toString(programOpts.isInteractive())); for (ParamModel pm : opts) { if (pm.getName().equals("printprompt")) uopts.add(p); else uopts.add(pm); } return uopts; }
/** * Add --adminport and --instanceport options with * proper default values. (Can't set default values above * because it conflicts with --portbase option processing.) */ protected Collection<ParamModel> usageOptions() { Collection<ParamModel> opts = commandModel.getParameters(); Set<ParamModel> uopts = new LinkedHashSet<ParamModel>(); ParamModel aPort = new ParamModelData(ADMIN_PORT, String.class, true, Integer.toString(CLIConstants.DEFAULT_ADMIN_PORT)); ParamModel iPort = new ParamModelData(INSTANCE_PORT, String.class, true, Integer.toString(DEFAULT_INSTANCE_PORT)); for (ParamModel pm : opts) { if (pm.getName().equals(ADMIN_PORT)) uopts.add(aPort); else if (pm.getName().equals(INSTANCE_PORT)) uopts.add(iPort); else uopts.add(pm); } return uopts; }
/** * Add --adminport and --instanceport options with proper default values. * (Can't set default values above because it conflicts with --portbase * option processing.) */ @Override protected Collection<ParamModel> usageOptions() { Collection<ParamModel> opts = commandModel.getParameters(); Set<ParamModel> uopts = new LinkedHashSet<ParamModel>(); ParamModel aPort = new ParamModelData(ADMIN_PORT, String.class, true, Integer.toString(CLIConstants.DEFAULT_ADMIN_PORT)); ParamModel iPort = new ParamModelData(INSTANCE_PORT, String.class, true, Integer.toString(DEFAULT_INSTANCE_PORT)); for (ParamModel pm : opts) { if (pm.getName().equals(ADMIN_PORT)) { uopts.add(aPort); } else if (pm.getName().equals(INSTANCE_PORT)) { uopts.add(iPort); } else { uopts.add(pm); } } return uopts; }
} else { Parser rcp = new Parser(argv, 1, commandModel.getParameters(), commandModel.unknownOptionsAreOperands()); options = rcp.getOptions();
} else { Parser rcp = new Parser(argv, 1, commandModel.getParameters(), commandModel.unknownOptionsAreOperands()); options = rcp.getOptions();
for (ParamModel opt : commandModel.getParameters()) { if (opt.getParam().primary()) { continue;
public void getHelp(AdminCommand command, ActionReport report) { CommandModel model = getModel(command); report.setActionDescription(model.getCommandName() + " help"); // XXX - this is a hack for now. if the request mapped to an // XMLContentActionReporter, that means we want the command metadata. if (report instanceof XMLContentActionReporter) { getMetadata(command, model, report); } else { report.setMessage(model.getCommandName() + " - " + model.getLocalizedDescription()); report.getTopMessagePart().addProperty("SYNOPSIS", encodeManPage(new BufferedReader(new StringReader( getUsageText(model))))); for (CommandModel.ParamModel param : model.getParameters()) { addParamUsage(report, param); } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } }
public void getHelp(AdminCommand command, ActionReport report) { CommandModel model = getModel(command); report.setActionDescription(model.getCommandName() + " help"); // XXX - this is a hack for now. if the request mapped to an // XMLContentActionReporter, that means we want the command metadata. if (report instanceof XMLContentActionReporter) { getMetadata(command, model, report); } else { report.setMessage(model.getCommandName() + " - " + model.getLocalizedDescription()); report.getTopMessagePart().addProperty("SYNOPSIS", encodeManPage(new BufferedReader(new StringReader( getUsageText(model))))); for (CommandModel.ParamModel param : model.getParameters()) { addParamUsage(report, param); } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } }
String argv[] = operands.toArray(new String[operands.size()]); parser = new Parser(argv, 0, commandModel.getParameters(), false); ParameterMap options = parser.getOptions(); operands = parser.getOperands(); if (pwfile != null && pwfile.length() > 0) { Map<String, String> passwords = CLIUtil.readPasswordFileOptions(pwfile, true); for (CommandModel.ParamModel opt : commandModel.getParameters()) { if (opt.getParam().password()) { String pwdname = opt.getName();
String argv[] = operands.toArray(new String[operands.size()]); parser = new Parser(argv, 0, commandModel.getParameters(), false); ParameterMap options = parser.getOptions(); operands = parser.getOperands(); if (pwfile != null && pwfile.length() > 0) { Map<String, String> passwords = CLIUtil.readPasswordFileOptions(pwfile, true); for (CommandModel.ParamModel opt : commandModel.getParameters()) { if (opt.getParam().password()) { String pwdname = opt.getName();
for (ParamModel opt : commandModel.getParameters()) { if (!opt.getParam().password()) continue;
for (ParamModel opt : commandModel.getParameters()) { if (!opt.getParam().password()) continue;