List of usage examples for org.apache.commons.cli Option Option
public Option(String opt, String longOpt, boolean hasArg, String description) throws IllegalArgumentException
From source file:com.netscape.cmstools.system.TPSConnectorAddCLI.java
public void createOptions() { Option option = new Option(null, "host", true, "TPS host"); option.setArgName("host"); options.addOption(option);//w ww . j a va 2 s .c o m option = new Option(null, "port", true, "TPS port"); option.setArgName("port"); options.addOption(option); }
From source file:com.palantir.atlasdb.shell.AtlasShellCli.java
public void run(String[] args) { Options options = new Options(); options.addOption(new Option("h", "help", false, "Prints help message.")); options.addOption(// ww w. j a v a 2 s. c om new Option("headless", "Force headless (non-GUI) mode; unnecessary if a scriptlet was specified.")); options.addOption(new Option("scriptlet", true, "Ruby to execute at start; specifying a scriptlet automatically forces headless mode." + " If the argument corresponds to a valid .rb file, then the contents of that" + " file will be executed. Otherwise, the argument will be treated directly as Ruby code.")); try { CommandLineParser parser = new GnuParser(); CommandLine cli = parser.parse(options, args); if (cli.hasOption("h")) { System.out.println("AtlasDBShell is an interface for manually inspecting an AtlasDB\n" + // (authorized) "instance (similar to squirrel or sqlplus for a SQL database).\n"); new HelpFormatter().printHelp("atlasDBShell", options, true); System.exit(0); // (authorized) } String scriptlet = cli.getOptionValue("scriptlet", ""); if (!scriptlet.isEmpty() && cli.hasOption("headless")) { System.out.println( "Note: specifying a scriptlet automatically forces atlasShell to run in headless mode."); // (authorized) } if (!scriptlet.isEmpty()) { atlasShellRun.runHeadless(turnRubyCodeOrRubyFileIntoRubyCode(scriptlet)); } else if (cli.hasOption("headless")) { atlasShellRun.runHeadless(""); } else { atlasShellRun.runHeaded(); } } catch (ParseException e) { System.out.println("Invalid command line - " + e.getMessage()); // (authorized) new HelpFormatter().printHelp("atlasDBShell", options, true); System.exit(1); // (authorized) } catch (HeadlessException e) { System.out.println( "Error: The graphics enviroment is set to headless. Try running with the --headless option."); // (authorized) new HelpFormatter().printHelp("atlasDBShell", options, true); System.exit(1); // (authorized) } }
From source file:com.netscape.cmstools.tps.token.TokenAddCLI.java
public void createOptions() { Option option = new Option(null, "user", true, "User ID"); option.setArgName("User ID"); options.addOption(option);/*from w w w . j av a 2 s.co m*/ option = new Option(null, "policy", true, "Policy"); option.setArgName("Policy"); options.addOption(option); }
From source file:com.aliyun.openservices.odps.console.commands.ShowTablesCommand.java
static Options initOptions() { Options opts = new Options(); Option project_name = new Option("p", "project", true, "project name"); project_name.setRequired(false);//from w ww. ja va 2 s . co m opts.addOption(project_name); return opts; }
From source file:com.netscape.cmstools.system.KRAConnectorRemoveCLI.java
public void createOptions() { Option option = new Option(null, "host", true, "KRA host"); option.setArgName("host"); options.addOption(option);/*from ww w. ja v a 2 s. c o m*/ option = new Option(null, "port", true, "KRA port"); option.setArgName("port"); options.addOption(option); }
From source file:com.netscape.cmstools.user.UserModifyCLI.java
public void createOptions() { Option option = new Option(null, "fullName", true, "Full name"); option.setArgName("fullName"); options.addOption(option);/* w ww . j a v a2 s . c o m*/ option = new Option(null, "email", true, "Email"); option.setArgName("email"); options.addOption(option); option = new Option(null, "password", true, "Password"); option.setArgName("password"); options.addOption(option); option = new Option(null, "phone", true, "Phone"); option.setArgName("phone"); options.addOption(option); // type cannot be modified // option = new Option(null, "type", true, "Type"); // option.setArgName("type"); // options.addOption(option); option = new Option(null, "state", true, "State"); option.setArgName("state"); options.addOption(option); }
From source file:com.netscape.cmstools.logging.AuditFileRetrieveCLI.java
public void createOptions() { Option option = new Option(null, "output", true, "Output file."); option.setArgName("path"); options.addOption(option);/*from ww w.j a v a 2 s .c o m*/ options.addOption(null, "help", false, "Show help message."); }
From source file:com.alibaba.rocketmq.tools.command.message.QueryMsgByKeySubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("t", "topic", true, "topic name"); opt.setRequired(true);//from www. j a v a 2s .c om options.addOption(opt); opt = new Option("k", "msgKey", true, "Message Key"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.netscape.cmstools.user.UserAddCLI.java
public void createOptions() { Option option = new Option(null, "fullName", true, "Full name"); option.setArgName("fullName"); option.setRequired(true);//from www . ja va2s . c om options.addOption(option); option = new Option(null, "email", true, "Email"); option.setArgName("email"); options.addOption(option); option = new Option(null, "password", true, "Password"); option.setArgName("password"); options.addOption(option); option = new Option(null, "phone", true, "Phone"); option.setArgName("phone"); options.addOption(option); option = new Option(null, "type", true, "Type"); option.setArgName("type"); options.addOption(option); option = new Option(null, "state", true, "State"); option.setArgName("state"); options.addOption(option); }
From source file:com.zimbra.cs.mailbox.calendar.FixCalendarEndTimeUtil.java
protected void setupCommandLineOptions() { super.setupCommandLineOptions(); Options options = getOptions();/*from w w w . ja va 2 s . c om*/ Option accountOpt = new Option(O_ACCOUNT, "account", true, "account email addresses seperated by white space or \"all\" for all accounts"); accountOpt.setArgs(Option.UNLIMITED_VALUES); options.addOption(accountOpt); options.addOption(new Option(null, O_SYNC, false, "run synchronously; default is asynchronous")); options.addOption(SoapCLI.OPT_AUTHTOKEN); options.addOption(SoapCLI.OPT_AUTHTOKENFILE); }