List of usage examples for org.apache.commons.cli OptionBuilder withDescription
public static OptionBuilder withDescription(String newDescription)
From source file:com.divinesoft.boynas.Boynas.java
public static void main(String args[]) { //TODO: Move Options to a different method Options options = new Options(); //Create options Option list = OptionBuilder.withDescription("List all config entries in database").create("list"); Option clean = OptionBuilder.withDescription("Remove all config entries in database").create("clean"); Option importCSV = OptionBuilder.withArgName("file").hasArg() .withDescription("Import config entries from a CSV file").create("importCSV"); Option exportXML = OptionBuilder.withDescription("Export all config entries to XML CFG files") .create("exportXML"); Option exportTemplate = OptionBuilder.withArgName("templates folder").hasArgs() .withDescription("Export all config entries from a set of template files").create("exportTemplate"); Option version = OptionBuilder.withDescription("Print the version number").create("version"); Option quickGen = OptionBuilder.withArgName("import file,templates folder") .withDescription("Use a one-shot template based config generator").hasArgs(2) .withValueSeparator(' ').create("quickExport"); //Add options options.addOption(list);//from ww w .j a v a 2s .c om options.addOption(clean); options.addOption(importCSV); options.addOption(exportXML); options.addOption(exportTemplate); options.addOption(quickGen); options.addOption(version); CommandLineParser parser = new GnuParser(); //The main Boynas object Boynas boynas; //Start dealing with application context XmlBeanFactory appContext = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("list")) { boynas = (Boynas) appContext.getBean("boynasList"); boynas.getAllConfigEntries(); } else if (cmd.hasOption("clean")) { boynas = (Boynas) appContext.getBean("boynasList"); boynas.clean(); } else if (cmd.hasOption("importCSV")) { Boynas.filePath = cmd.getOptionValue("importCSV"); boynas = (Boynas) appContext.getBean("bynImportCSV"); boynas.importCSV(); } else if (cmd.hasOption("exportXML")) { boynas = (Boynas) appContext.getBean("bynExportXML"); boynas.exportXML(); } else if (cmd.hasOption("version")) { boynas = (Boynas) appContext.getBean("boynasList"); boynas.printVersion(); } else if (cmd.hasOption("exportTemplate")) { Boynas.templatePath = cmd.getOptionValue("exportTemplate"); boynas = (Boynas) appContext.getBean("bynExportTemplate"); boynas.exportTemplate(); } else if (cmd.hasOption("quickExport")) { String[] paths = cmd.getOptionValues("quickExport"); if (paths.length < 2) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("boynas", options); } Boynas.filePath = paths[0]; Boynas.templatePath = paths[1]; boynas = (Boynas) appContext.getBean("bynQuickExport"); boynas.quickExport(); } else { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("boynas", options); } } catch (ParseException e) { System.err.println("Parsing failed. Reason: " + e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("boynas", options); } }
From source file:edu.harvard.med.iccbl.screensaver.io.screens.ScreenPrivacyExpirationUpdater.java
@SuppressWarnings("static-access") public static void main(String[] args) { final ScreenPrivacyExpirationUpdater app = new ScreenPrivacyExpirationUpdater(args); // TODO: allow this to be optional and glean the eCommons ID from the // environment - sde4 app.addCommandLineOption(OptionBuilder.hasArg().isRequired().withArgName(SCREEN_TYPE_OPTION[ARG_INDEX]) .withDescription(SCREEN_TYPE_OPTION[DESCRIPTION_INDEX]) .withLongOpt(SCREEN_TYPE_OPTION[LONG_OPTION_INDEX]).create(SCREEN_TYPE_OPTION[SHORT_OPTION_INDEX])); app.addCommandLineOption(/*from www. jav a 2 s. c om*/ OptionBuilder.hasArg().withArgName(ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[ARG_INDEX]) .withDescription(ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[DESCRIPTION_INDEX]) .withLongOpt(ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[LONG_OPTION_INDEX]) .create(ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.withDescription(NOTIFY_OF_OVERRIDES[DESCRIPTION_INDEX]) .withLongOpt(NOTIFY_OF_OVERRIDES[LONG_OPTION_INDEX]) .create(NOTIFY_OF_OVERRIDES[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.withDescription(EXPIRE_PRIVACY[DESCRIPTION_INDEX]) .withLongOpt(EXPIRE_PRIVACY[LONG_OPTION_INDEX]).create(EXPIRE_PRIVACY[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.hasArg().withArgName(NOTIFY_PRIVACY_EXPIRATION[ARG_INDEX]) .withDescription(NOTIFY_PRIVACY_EXPIRATION[DESCRIPTION_INDEX]) .withLongOpt(NOTIFY_PRIVACY_EXPIRATION[LONG_OPTION_INDEX]) .create(NOTIFY_PRIVACY_EXPIRATION[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.hasArg().withArgName(EXPIRATION_EMAIL_MESSAGE_LOCATION[ARG_INDEX]) .withDescription(EXPIRATION_EMAIL_MESSAGE_LOCATION[DESCRIPTION_INDEX]) .withLongOpt(EXPIRATION_EMAIL_MESSAGE_LOCATION[LONG_OPTION_INDEX]) .create(EXPIRATION_EMAIL_MESSAGE_LOCATION[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.withDescription(NOTIFY_OF_PUBLICATIONS[DESCRIPTION_INDEX]) .withLongOpt(NOTIFY_OF_PUBLICATIONS[LONG_OPTION_INDEX]) .create(NOTIFY_OF_PUBLICATIONS[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.withDescription(TEST_ONLY[DESCRIPTION_INDEX]) .withLongOpt(TEST_ONLY[LONG_OPTION_INDEX]).create(TEST_ONLY[SHORT_OPTION_INDEX])); app.processOptions(/* acceptDatabaseOptions= */true, /* acceptAdminUserOptions= */true); log.info("==== Running ScreenPrivacyExpirationUpdater: " + app.toString() + "======"); final GenericEntityDAO dao = (GenericEntityDAO) app.getSpringBean("genericEntityDao"); app.init(); dao.doInTransaction(new DAOTransaction() { public void runTransaction() { try { // check that not too many options are specified int numberOfActions = 0; if (app.isCommandLineFlagSet(NOTIFY_PRIVACY_EXPIRATION[SHORT_OPTION_INDEX])) numberOfActions++; if (app.isCommandLineFlagSet(NOTIFY_OF_PUBLICATIONS[SHORT_OPTION_INDEX])) numberOfActions++; if (app.isCommandLineFlagSet(EXPIRE_PRIVACY[SHORT_OPTION_INDEX])) numberOfActions++; if (app.isCommandLineFlagSet( ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[SHORT_OPTION_INDEX])) numberOfActions++; if (numberOfActions > 1) { log.error("May only specify one of: " + NOTIFY_PRIVACY_EXPIRATION[SHORT_OPTION_INDEX] + ", " + NOTIFY_OF_PUBLICATIONS[SHORT_OPTION_INDEX] + ", " + EXPIRE_PRIVACY[SHORT_OPTION_INDEX] + ", " + ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[SHORT_OPTION_INDEX]); System.exit(1); } app.setScreenType(app.getCommandLineOptionEnumValue(SCREEN_TYPE_OPTION[SHORT_OPTION_INDEX], ScreenType.class)); try { if (app.isCommandLineFlagSet(NOTIFY_PRIVACY_EXPIRATION[SHORT_OPTION_INDEX])) { Integer daysAheadToNotify = app.getCommandLineOptionValue( NOTIFY_PRIVACY_EXPIRATION[SHORT_OPTION_INDEX], Integer.class); app.findNewExpiredAndNotifyAhead(daysAheadToNotify); } else if (app.isCommandLineFlagSet(NOTIFY_OF_PUBLICATIONS[SHORT_OPTION_INDEX])) { app.notifyOfPublications(); } else if (app.isCommandLineFlagSet(EXPIRE_PRIVACY[SHORT_OPTION_INDEX])) { app.expireScreenDataSharingLevels(); } else if (app.isCommandLineFlagSet( ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[SHORT_OPTION_INDEX])) { Integer ageToExpireFromActivityDateInDays = app.getCommandLineOptionValue( ADJUST_DATA_PRIVACY_EXPIRATION_DATE_BASED_ON_ACTIVITY[SHORT_OPTION_INDEX], Integer.class); app.adjustDataPrivacyExpirationByActivities(ageToExpireFromActivityDateInDays); } else { app.showHelpAndExit( "No action specified (expire, notify of privacy expirations, notify of publications, or adjust)?"); } } catch (OperationRestrictedException e) { app.sendErrorMail("Warn: Could not complete expiration service operation", "Warn: Could not complete expiration service operation", e); throw new DAOTransactionRollbackException(e); } } catch (MessagingException e) { String msg = "Admin email operation not completed due to MessagingException"; log.error(msg + ":\nApp: " + app.toString(), e); throw new DAOTransactionRollbackException(e); } if (app.isCommandLineFlagSet(TEST_ONLY[SHORT_OPTION_INDEX])) { throw new DAOTransactionRollbackException("Rollback, testing only"); } } }); log.info("==== finished ScreenPrivacyExpirationUpdater ======"); }
From source file:edu.harvard.med.iccbl.screensaver.io.screens.ScreenPositivesCountStudyCreator.java
@SuppressWarnings("static-access") public static void main(String[] args) throws MessagingException { final ScreenPositivesCountStudyCreator app = new ScreenPositivesCountStudyCreator(args); String[] option = OPTION_STUDY_TITLE; app.addCommandLineOption(//from www.j av a 2 s . co m OptionBuilder.hasArg().withArgName(option[ARG_INDEX]).withDescription(option[DESCRIPTION_INDEX]) .withLongOpt(option[LONG_OPTION_INDEX]).create(option[SHORT_OPTION_INDEX])); option = OPTION_STUDY_NUMBER; app.addCommandLineOption(OptionBuilder.hasArg().withType(Integer.class).withArgName(option[ARG_INDEX]) .withDescription(option[DESCRIPTION_INDEX]).withLongOpt(option[LONG_OPTION_INDEX]) .create(option[SHORT_OPTION_INDEX])); option = OPTION_STUDY_SUMMARY; app.addCommandLineOption( OptionBuilder.hasArg().withArgName(option[ARG_INDEX]).withDescription(option[DESCRIPTION_INDEX]) .withLongOpt(option[LONG_OPTION_INDEX]).create(option[SHORT_OPTION_INDEX])); option = OPTION_SCREEN_TYPE_SM; app.addCommandLineOption(OptionBuilder.withDescription(option[DESCRIPTION_INDEX]) .withLongOpt(option[LONG_OPTION_INDEX]).create(option[SHORT_OPTION_INDEX])); option = OPTION_SCREEN_TYPE_RNAI; app.addCommandLineOption(OptionBuilder.withDescription(option[DESCRIPTION_INDEX]) .withLongOpt(option[LONG_OPTION_INDEX]).create(option[SHORT_OPTION_INDEX])); option = OPTION_REPLACE; app.addCommandLineOption(OptionBuilder.withDescription(option[DESCRIPTION_INDEX]) .withLongOpt(option[LONG_OPTION_INDEX]).create(option[SHORT_OPTION_INDEX])); app.addCommandLineOption(OptionBuilder.withDescription(TEST_ONLY[DESCRIPTION_INDEX]) .withLongOpt(TEST_ONLY[LONG_OPTION_INDEX]).create(TEST_ONLY[SHORT_OPTION_INDEX])); app.processOptions(/* acceptDatabaseOptions= */true, /* acceptAdminUserOptions= */true); log.info("==== Running ScreenPositivesCountStudyCreator: " + app.toString() + "======"); try { app.execute(); } catch (Exception e) { String subject = "Execution failure for " + app.getClass().getName(); String msg = subject + "\n" + app.toString(); app.sendErrorMail(subject, msg, e); System.exit(1); } }
From source file:com.maxl.java.aips2sqlite.Aips2Sqlite.java
/** * Adds an option into the command line parser * //from w w w. j av a2 s .c o m * @param optionName - the option name * @param description - option descriptiuon * @param hasValue - if set to true, --option=value, otherwise, --option is a boolean * @param isMandatory - if set to true, the option must be provided. */ @SuppressWarnings("static-access") static void addOption(Options opts, String optionName, String description, boolean hasValue, boolean isMandatory) { OptionBuilder opt = OptionBuilder.withLongOpt(optionName); opt = opt.withDescription(description); if (hasValue) opt = opt.hasArg(); if (isMandatory) opt = opt.isRequired(); opts.addOption(opt.create()); }
From source file:eu.fbk.dkm.sectionextractor.pantheon.WikipediaGoodTextExtractor.java
public static void main(String args[]) throws IOException { CommandLineWithLogger commandLineWithLogger = new CommandLineWithLogger(); commandLineWithLogger.addOption(OptionBuilder.withArgName("file").hasArg() .withDescription("wikipedia xml dump file").isRequired().withLongOpt("wikipedia-dump").create("d")); commandLineWithLogger.addOption(OptionBuilder.withArgName("dir").hasArg() .withDescription("output directory in which to store output files").isRequired() .withLongOpt("output-dir").create("o")); commandLineWithLogger//from w w w. j a v a2s . c o m .addOption(OptionBuilder.withDescription("use NAF format").withLongOpt("naf").create("n")); commandLineWithLogger.addOption(OptionBuilder.withDescription("tokenize and ssplit with Stanford") .withLongOpt("stanford").create("s")); commandLineWithLogger.addOption(OptionBuilder.withArgName("file").hasArg().withDescription("Filter file") .withLongOpt("filter").create("f")); commandLineWithLogger.addOption(OptionBuilder.withArgName("file").hasArg() .withDescription("ID and category file").withLongOpt("idcat").create("i")); commandLineWithLogger.addOption(OptionBuilder.withArgName("file").hasArg().withDescription("Redirect file") .withLongOpt("redirect").create("r")); commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg() .withDescription( "number of threads (default " + AbstractWikipediaXmlDumpParser.DEFAULT_THREADS_NUMBER + ")") .withLongOpt("num-threads").create("t")); commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg() .withDescription("number of pages to process (default all)").withLongOpt("num-pages").create("p")); commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg() .withDescription("receive notification every n pages (default " + AbstractWikipediaExtractor.DEFAULT_NOTIFICATION_POINT + ")") .withLongOpt("notification-point").create("b")); commandLineWithLogger.addOption(new Option("n", "NAF format")); CommandLine commandLine = null; try { commandLine = commandLineWithLogger.getCommandLine(args); PropertyConfigurator.configure(commandLineWithLogger.getLoggerProps()); } catch (Exception e) { System.exit(1); } int numThreads = Integer.parseInt(commandLine.getOptionValue("num-threads", Integer.toString(AbstractWikipediaXmlDumpParser.DEFAULT_THREADS_NUMBER))); int numPages = Integer.parseInt(commandLine.getOptionValue("num-pages", Integer.toString(AbstractWikipediaExtractor.DEFAULT_NUM_PAGES))); int notificationPoint = Integer.parseInt(commandLine.getOptionValue("notification-point", Integer.toString(AbstractWikipediaExtractor.DEFAULT_NOTIFICATION_POINT))); boolean nafFormat = commandLine.hasOption("n"); boolean useStanford = commandLine.hasOption("s"); HashMap<Integer, String> idCategory = new HashMap<>(); String idcatFileName = commandLine.getOptionValue("idcat"); if (idcatFileName != null) { logger.info("Loading categories"); File idcatFile = new File(idcatFileName); if (idcatFile.exists()) { List<String> lines = Files.readLines(idcatFile, Charsets.UTF_8); for (String line : lines) { line = line.trim(); if (line.length() == 0) { continue; } String[] parts = line.split("\\s+"); if (parts.length < 3) { continue; } idCategory.put(Integer.parseInt(parts[1]), parts[2]); } } } HashMap<String, String> redirects = new HashMap<>(); String redirectFileName = commandLine.getOptionValue("redirect"); if (redirectFileName != null) { logger.info("Loading redirects"); File redirectFile = new File(redirectFileName); if (redirectFile.exists()) { List<String> lines = Files.readLines(redirectFile, Charsets.UTF_8); for (String line : lines) { line = line.trim(); if (line.length() == 0) { continue; } String[] parts = line.split("\\t+"); if (parts.length < 2) { continue; } redirects.put(parts[0], parts[1]); } } } HashSet<String> pagesToConsider = null; String filterFileName = commandLine.getOptionValue("filter"); if (filterFileName != null) { logger.info("Loading file list"); File filterFile = new File(filterFileName); if (filterFile.exists()) { pagesToConsider = new HashSet<>(); List<String> lines = Files.readLines(filterFile, Charsets.UTF_8); for (String line : lines) { line = line.trim(); if (line.length() == 0) { continue; } line = line.replaceAll("\\s+", "_"); pagesToConsider.add(line); addRedirects(pagesToConsider, redirects, line, 0); } } } ExtractorParameters extractorParameters = new ExtractorParameters( commandLine.getOptionValue("wikipedia-dump"), commandLine.getOptionValue("output-dir")); File outputFolder = new File(commandLine.getOptionValue("output-dir")); if (!outputFolder.exists()) { boolean mkdirs = outputFolder.mkdirs(); if (!mkdirs) { throw new IOException("Unable to create folder " + outputFolder.getAbsolutePath()); } } WikipediaExtractor wikipediaPageParser = new WikipediaGoodTextExtractor(numThreads, numPages, extractorParameters.getLocale(), outputFolder, nafFormat, pagesToConsider, useStanford, idCategory); wikipediaPageParser.setNotificationPoint(notificationPoint); wikipediaPageParser.start(extractorParameters); logger.info("extraction ended " + new Date()); }
From source file:com.comcast.oscar.cli.commands.FullTLVDisplay.java
/** * Set option parameters for command Full TLV display * @return Option//w w w. ja va2 s .c o m */ public static final Option OptionParameters() { OptionBuilder.withValueSeparator(' '); OptionBuilder.withLongOpt("fulltlvdisplay"); OptionBuilder .withDescription("Display all TLVs available in the dictionary for the defined specification."); return OptionBuilder.create("ftd"); }
From source file:ch.cyberduck.cli.TerminalOptionsBuilder.java
public static Options options() { final Options options = new Options(); options.addOption(OptionBuilder.withDescription("Username").withLongOpt(Params.username.name()).hasArg(true) .withArgName("username or access key").isRequired(false).create('u')); options.addOption(OptionBuilder.withDescription("Password").withLongOpt(Params.password.name()).hasArg(true) .withArgName("password or secret key").isRequired(false).create('p')); options.addOption(OptionBuilder.withDescription( "Selects a file from which the identity (private key) for public key authentication is read") .withLongOpt(Params.identity.name()).hasArg(true).withArgName("private key file").isRequired(false) .create('i')); options.addOption(// w w w .j av a2s . co m OptionBuilder.withDescription("Download file or folder. Denote a folder with a trailing '/'") .withLongOpt(TerminalAction.download.name()).hasArgs(2).withArgName("url> <[file]") .withValueSeparator(' ').isRequired(false).create('d')); options.addOption(OptionBuilder.withDescription("Upload file or folder recursively") .withLongOpt(TerminalAction.upload.name()).hasArgs(2).withArgName("url> <file") .withValueSeparator(' ').isRequired(false).create()); options.addOption( OptionBuilder.withDescription("Set explicit permission from octal mode value for uploaded file") .withLongOpt(Params.chmod.name()).hasArgs(1).withArgName("<mode>").withValueSeparator(' ') .isRequired(false).create()); options.addOption( OptionBuilder.withDescription("Copy between servers").withLongOpt(TerminalAction.copy.name()) .hasArgs(2).withArgName("url> <url").withValueSeparator(' ').isRequired(false).create()); options.addOption(OptionBuilder.withDescription("Synchronize folders") .withLongOpt(TerminalAction.synchronize.name()).hasArgs(2).withArgName("url> <directory") .withValueSeparator(' ').isRequired(false).create()); options.addOption(OptionBuilder.withDescription("Edit file in external editor") .withLongOpt(TerminalAction.edit.name()).hasArgs(1).withArgName("url").isRequired(false).create()); options.addOption(OptionBuilder.withDescription("External editor application") .withLongOpt(Params.application.name()).hasArgs(1).withArgName("path").isRequired(false).create()); options.addOption( OptionBuilder.withDescription("List files in remote folder").withLongOpt(TerminalAction.list.name()) .hasArg(true).withArgName("url").isRequired(false).create("l")); options.addOption(OptionBuilder.withDescription("Delete").withLongOpt(TerminalAction.delete.name()) .hasArg(true).withArgName("url").isRequired(false).create("D")); options.addOption(OptionBuilder .withDescription("Long list format with modification date and permission mask") .withLongOpt(Params.longlist.name()).hasArg(true).withArgName("url").isRequired(false).create('L')); options.addOption(OptionBuilder.withDescription("Location of bucket or container") .withLongOpt(Params.region.name()).hasArg(true).withArgName("location").isRequired(false).create()); options.addOption( OptionBuilder.withDescription("Preserve permissions and modification date for transferred files") .withLongOpt(Params.preserve.name()).hasArg(false).isRequired(false).create('P')); options.addOption( OptionBuilder.withDescription("Retry failed connection attempts").withLongOpt(Params.retry.name()) .hasOptionalArg().withArgName("count").isRequired(false).create('r')); options.addOption(OptionBuilder.withDescription("Use UDT protocol if applicable") .withLongOpt(Params.udt.name()).isRequired(false).create()); options.addOption(OptionBuilder.withDescription("Number of concurrent connections to use for transfers") .withLongOpt(Params.parallel.name()).hasOptionalArg().withArgName("connections").isRequired(false) .create()); options.addOption(OptionBuilder.withDescription("Throttle bandwidth").withLongOpt(Params.throttle.name()) .hasArg(true).withArgName("bytes per second").isRequired(false).create()); options.addOption(OptionBuilder.withDescription("Do not save passwords in keychain") .withLongOpt(Params.nokeychain.name()).isRequired(false).create()); final StringBuilder b = new StringBuilder().append(StringUtils.LF); b.append("Options for downloads and uploads:").append(StringUtils.LF); for (TransferAction a : TransferAction.forTransfer(Transfer.Type.download)) { b.append("\t").append(a.getTitle()).append("\t").append(a.getDescription()) .append(String.format(" (%s)", a.name())).append(StringUtils.LF); } for (TransferAction a : Collections.singletonList(TransferAction.cancel)) { b.append("\t").append(a.getTitle()).append("\t").append(a.getDescription()) .append(String.format(" (%s)", a.name())).append(StringUtils.LF); } b.append("Options for synchronize:").append(StringUtils.LF); for (TransferAction a : TransferAction.forTransfer(Transfer.Type.sync)) { b.append("\t").append(a.getTitle()).append("\t").append(a.getDescription()) .append(String.format(" (%s)", a.name())).append(StringUtils.LF); } for (TransferAction a : Collections.singletonList(TransferAction.cancel)) { b.append("\t").append(a.getTitle()).append("\t").append(a.getDescription()) .append(String.format(" (%s)", a.name())).append(StringUtils.LF); } options.addOption( OptionBuilder.withDescription(String.format("Transfer action for existing files%s", b.toString())) .withLongOpt(Params.existing.name()).hasArg(true).withArgName("action").isRequired(false) .create('e')); options.addOption(OptionBuilder.withDescription("Print transcript").withLongOpt(Params.verbose.name()) .hasArg(false).isRequired(false).create('v')); options.addOption(OptionBuilder.withDescription("Suppress progress messages") .withLongOpt(Params.quiet.name()).hasArg(false).isRequired(false).create('q')); options.addOption(OptionBuilder.withDescription("Assume yes for all prompts") .withLongOpt(Params.assumeyes.name()).hasArg(false).isRequired(false).create('y')); options.addOption(OptionBuilder.withDescription("Show version number and quit") .withLongOpt(TerminalAction.version.name()).hasArg(false).isRequired(false).create('V')); options.addOption(OptionBuilder.withDescription("Print this help").withLongOpt(TerminalAction.help.name()) .hasArg(false).isRequired(false).create("h")); return options; }
From source file:com.comcast.oscar.cli.commands.Key.java
/** * Set option parameters for command Key * @return Option//from w w w .j a va2s.c o m */ public static Option OptionParameters() { OptionBuilder.withArgName("key filename"); OptionBuilder.hasArgs(1); OptionBuilder.hasOptionalArgs(); OptionBuilder.withValueSeparator(' '); OptionBuilder.withLongOpt("key"); OptionBuilder.withDescription("Use this sharedsecret to compile the file - DOCSIS ONLY."); return OptionBuilder.create("k"); }
From source file:com.comcast.oscar.cli.commands.TLV.java
/** * Set option parameters for command TLV * @return Option/*w w w.j a va 2 s . c om*/ */ public static final Option OptionParameters() { OptionBuilder.withArgName("TLV"); OptionBuilder.hasArgs(1); OptionBuilder.hasOptionalArgs(); OptionBuilder.withValueSeparator(' '); OptionBuilder.withLongOpt("tlv"); OptionBuilder.withDescription("Insert this TLV during file compilation."); return OptionBuilder.create("t"); }
From source file:com.comcast.oscar.cli.commands.Firmware.java
/** * Set option parameters for command Firmware * @return Option/*from w w w. j a va 2 s .co m*/ */ public static final Option OptionParameters() { OptionBuilder.withArgName("filename"); OptionBuilder.hasArgs(1); OptionBuilder.hasOptionalArgs(); OptionBuilder.withValueSeparator(' '); OptionBuilder.withLongOpt("firmware"); OptionBuilder.withDescription("Insert this firmware during file compilation."); return OptionBuilder.create("f"); }