List of usage examples for org.apache.commons.cli OptionGroup addOption
public OptionGroup addOption(Option option)
Option
to this group. From source file:org.jboss.security.fips.utils.FIPSVaultOptions.java
/** * Build the command line options for the vault tool *///from w w w .ja v a 2s . c om private void initOptions() { options = new Options(); OptionGroup og = new OptionGroup(); Option n = new Option("n", IS_NEW_VAULT_PARAM, false, "This is a newly created vault"); Option h = new Option("h", HELP_PARAM, false, "Help"); og.addOption(n); og.addOption(h); options.addOptionGroup(og); }
From source file:org.jcryptool.commands.core.api.AbstractCommand.java
@SuppressWarnings("static-access") protected void createInputOptions(Options options) { OptionGroup inputMode = new OptionGroup(); inputMode.addOption(OptionBuilder.withLongOpt(TEXTINPUT_LONG_OPTIONNAME).hasArg(true) .withArgName(TEXTINPUT_ARGUMENT1_NAME).withDescription(Messages.AbstractCommand_0) .create(TEXTINPUT_OPTIONNAME)); inputMode.addOption(OptionBuilder.withLongOpt(FILEINPUT_LONG_OPTIONNAME).hasArg(true) .withArgName(FILEINPUT_ARGUMENT1_NAME).withDescription(Messages.AbstractCommand_1) .create(FILEINPUT_OPTIONNAME)); inputMode.addOption(OptionBuilder.withLongOpt(EDITORINPUT_LONG_OPTIONNAME).hasArg(false) .withDescription(Messages.AbstractCommand_2).create(EDITORINPUT_OPTIONNAME)); inputMode.setRequired(true);//w w w . java 2 s.co m options.addOptionGroup(inputMode); }
From source file:org.jcryptool.crypto.classic.model.algorithm.ClassicAlgorithmCmd.java
@SuppressWarnings("static-access") public Options createOptions() { Options options = new Options(); // key input options createKeyOptions(options);/*from w w w . j a v a 2 s . co m*/ // Alphabet input options createAlphabetOptions(options); // Option not to filter nonalphabetic characters (if option is set, filtering does NOT occur) -> filtering by default. options.addOption(OptionBuilder.withLongOpt(NOFILTER_LONG_OPTIONNAME).hasArg( //$NON-NLS-1$ false).withDescription(Messages.ClassicAlgorithmCmd_filteroption).create(NOFILTER_OPTIONNAME)); //$NON-NLS-1$ // Encoding or decoding options group: OptionGroup codingMode = new OptionGroup(); codingMode.addOption(OptionBuilder.withLongOpt(MODEENCRYPTION_LONG_OPTIONNAME).hasArg( //$NON-NLS-1$ false).withDescription(Messages.ClassicAlgorithmCmd_encryptMode).create(MODEENCRYPTION_OPTIONNAME)); //$NON-NLS-1$ codingMode.addOption(OptionBuilder.withLongOpt(MODEDECRYPTION_LONG_OPTIONNAME).hasArg( //$NON-NLS-1$ false).withDescription(Messages.ClassicAlgorithmCmd_decryptMode).create(MODEDECRYPTION_OPTIONNAME)); //$NON-NLS-1$ codingMode.setRequired(true); options.addOptionGroup(codingMode); // Text input option group createInputOptions(options); // other options contributed by subclasses createOtherOptions(options); return options; }
From source file:org.jcryptool.crypto.classic.xor.algorithm.XorCmd.java
@SuppressWarnings("static-access") @Override//from ww w. j av a 2 s. c o m protected void createKeyOptions(Options options) { OptionGroup keyGrp = new OptionGroup(); keyGrp.addOption(OptionBuilder.withLongOpt("key").hasArg(true) //$NON-NLS-1$ .withArgName("KEY").withDescription( //$NON-NLS-1$ Messages.XorCmd_keyDetailsString) .create("k")); //$NON-NLS-1$ keyGrp.addOption(OptionBuilder.withLongOpt("keyFile").hasArg(true) //$NON-NLS-1$ .withArgName("KEYFILE").withDescription( //$NON-NLS-1$ Messages.XorCmd_keyDetailsFilepath) .create("kFile")); //$NON-NLS-1$ options.addOptionGroup(keyGrp); }
From source file:org.jhub1.agent.run.cli.ParamsMain.java
private Options getMainOptions() { OptionGroup groupMain = new OptionGroup(); for (Params paramsProcessor : paramsProcessors) { groupMain.addOption(paramsProcessor.getOptionsSignature()); }/*from www . j a v a2 s. c om*/ groupMain.addOption(new Option("h", "help", false, "print this message")); options = new Options(); options.addOptionGroup(groupMain); return options; }
From source file:org.jhub1.agent.run.cli.ParamsProcessorIQ.java
@Override protected Options getOptions() { Options optionsIQ = new Options(); Option q = getOption("q"); q.setRequired(true);/*from w w w .java 2 s .c o m*/ optionsIQ.addOption(q); OptionGroup groupIQoperation = new OptionGroup(); groupIQoperation.addOption(getOption("of")); groupIQoperation.addOption(getOption("po")); optionsIQ.addOptionGroup(groupIQoperation); OptionGroup groupIQtarget = new OptionGroup(); groupIQtarget.addOption(getOption("in")); groupIQtarget.addOption(getOption("out")); optionsIQ.addOptionGroup(groupIQtarget); return optionsIQ; }
From source file:org.jhub1.agent.run.cli.ParamsProcessorSample.java
@Override protected Options getOptions() { Options optionsSamples = new Options(); Option s = getOption("s"); s.setRequired(true);/* w w w.j av a2 s . c om*/ optionsSamples.addOption(s); optionsSamples.addOption(getOption("n")); optionsSamples.addOption(getOption("v")); optionsSamples.addOption(getOption("t")); optionsSamples.addOption(getOption("g")); OptionGroup groupSampleMain = new OptionGroup(); groupSampleMain.addOption(getOption("r")); groupSampleMain.addOption(getOption("p")); optionsSamples.addOptionGroup(groupSampleMain); return optionsSamples; }
From source file:org.jini.commands.files.FindFiles.java
/** * In this method all the Command specific Command Line options are defined. * *///w w w .j ava2 s . c o m @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("path").withDescription("Path").hasArg(true) .isRequired(false).create("p")); this.jcOptions.addOption(OptionBuilder.withLongOpt("withdetails").withDescription("With Details") .isRequired(false).create("wd")); this.jcOptions.addOption(OptionBuilder.withLongOpt("notrecursive").withDescription("Non Recursive") .hasArg(false).isRequired(false).create("nr")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("extension").withDescription("Search with extensions") .hasArg(true).isRequired(false).create("ex")); jcGroup.addOption( OptionBuilder.withLongOpt("wildcard").withDescription("Wild Card Option").hasArg().create("wc")); this.jcOptions.addOptionGroup(jcGroup); }
From source file:org.jini.commands.files.JiniCopyFiles.java
/** * In this method all the Command specific Command Line options are defined. * *//*from www . ja v a 2 s. c om*/ @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("all").withDescription("All files starting with . ") .isRequired(false).create("a")); this.jcOptions.addOption( OptionBuilder.withLongOpt("verbose").withDescription("Verbose").isRequired(false).create("v")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("hiddenfiles").withDescription("Copy Hidden Files") .isRequired(false).create("hf")); jcGroup.addOption(OptionBuilder.withLongOpt("wildcard").withDescription("Wild Card Option").hasArg(true) .isRequired(false).create("wc")); this.jcOptions.addOptionGroup(jcGroup); this.jcOptions.addOption(OptionBuilder.withLongOpt("from").withDescription("From").hasArg(true) .isRequired(false).create("f")); this.jcOptions.addOption( OptionBuilder.withLongOpt("to").withDescription("TO").hasArg(true).isRequired(false).create("t")); this.jcOptions.addOption( OptionBuilder.withLongOpt("verbose").withDescription("Verbose").isRequired(false).create("v")); }
From source file:org.jini.commands.files.List.java
/** * In this method all the Command specific Command Line options are defined. * *//* w w w.j av a2s.co m*/ @Override @SuppressWarnings("static-access") public void setJCLIOptions() { Option Help = new Option("h", "help", false, "Show Help."); this.jcOptions.addOption(Help); this.jcOptions.addOption(OptionBuilder.withLongOpt("path").withDescription("Path").hasArg(true) .isRequired(false).create("p")); this.jcOptions.addOption(OptionBuilder.withLongOpt("withdetails").withDescription("With Details") .isRequired(false).create("wd")); this.jcOptions.addOption(OptionBuilder.withLongOpt("result_type").withDescription("Result Type") .isRequired(false).hasArg().create("rt")); this.jcOptions.addOption(OptionBuilder.withLongOpt("showall").withDescription("Show All Files") .isRequired(false).create("all")); OptionGroup jcGroup = new OptionGroup(); jcGroup.addOption(OptionBuilder.withLongOpt("filesonly").withDescription("Show Files Only").create("fo")); jcGroup.addOption(OptionBuilder.withLongOpt("dirsonly").withDescription("Show Dirs Only").create("do")); jcGroup.addOption(OptionBuilder.withLongOpt("hiddenfiles").withDescription("Hidden Files").create("hf")); jcGroup.addOption( OptionBuilder.withLongOpt("hiddendirs").withDescription("Hidden Directories").create("hd")); jcGroup.addOption( OptionBuilder.withLongOpt("wildcard").withDescription("Wild Card Option").hasArg().create("wc")); this.jcOptions.addOptionGroup(jcGroup); OptionGroup jcGroup2 = new OptionGroup(); jcGroup2.addOption(OptionBuilder.withLongOpt("orderbydate").withDescription("Order By Date") .isRequired(false).hasArg().create("obd")); jcGroup2.addOption(OptionBuilder.withLongOpt("orderbyname").withDescription("Order By Name") .isRequired(false).hasArg().create("obn")); this.jcOptions.addOptionGroup(jcGroup2); }