Java Code Examples for org.apache.commons.cli.OptionGroup#setRequired()
The following examples show how to use
org.apache.commons.cli.OptionGroup#setRequired() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZooKeeperMigratorMain.java From nifi with Apache License 2.0 | 6 votes |
private static Options createOptions() { final Options options = new Options(); options.addOption(OPTION_ZK_MIGRATOR_HELP); options.addOption(OPTION_ZK_ENDPOINT); options.addOption(OPTION_ZK_AUTH_INFO); options.addOption(OPTION_FILE); options.addOption(OPTION_IGNORE_SOURCE); options.addOption(OPTION_USE_EXISTING_ACL); final OptionGroup optionGroupAuth = new OptionGroup().addOption(OPTION_ZK_AUTH_INFO).addOption(OPTION_ZK_KRB_CONF_FILE); optionGroupAuth.setRequired(false); options.addOptionGroup(optionGroupAuth); final OptionGroup optionGroupReadWrite = new OptionGroup().addOption(OPTION_RECEIVE).addOption(OPTION_SEND); optionGroupReadWrite.setRequired(true); options.addOptionGroup(optionGroupReadWrite); return options; }
Example 2
Source File: JobCommand.java From incubator-gobblin with Apache License 2.0 | 6 votes |
private Options createCommandLineOptions() { Options options = new Options(); OptionGroup actionGroup = new OptionGroup(); actionGroup.addOption(new Option("h", HELP_OPT, false, "Shows the help message.")); actionGroup.addOption(new Option("d", DETAILS_OPT, false, "Show details about a job/task.")); actionGroup.addOption(new Option("l", LIST_OPT, false, "List jobs/tasks.")); actionGroup.addOption(new Option("p", PROPS_OPT, false, "Fetch properties with the query.")); actionGroup.setRequired(true); options.addOptionGroup(actionGroup); OptionGroup idGroup = new OptionGroup(); idGroup.addOption(new Option("j", NAME_OPT, true, "Find job(s) matching given job name.")); idGroup.addOption(new Option("i", ID_OPT, true, "Find the job/task with the given id.")); options.addOptionGroup(idGroup); options.addOption("n", true, "Limit the number of results returned. (default:" + DEFAULT_RESULTS_LIMIT + ")"); options.addOption("r", RECENT_OPT, false, "List the most recent jobs (instead of a list of unique jobs)"); options.addOption("H", ADMIN_SERVER, true, "hostname of admin server"); options.addOption("P", ADMIN_PORT, true, "port of admin server"); return options; }
Example 3
Source File: CubeMetaExtractor.java From kylin with Apache License 2.0 | 6 votes |
public CubeMetaExtractor() { super(); OptionGroup realizationOrProject = new OptionGroup(); realizationOrProject.addOption(OPTION_CUBE); realizationOrProject.addOption(OPTION_PROJECT); realizationOrProject.addOption(OPTION_HYBRID); realizationOrProject.addOption(OPTION_All_PROJECT); realizationOrProject.setRequired(true); options.addOptionGroup(realizationOrProject); options.addOption(OPTION_INCLUDE_SEGMENTS); options.addOption(OPTION_INCLUDE_JOB); options.addOption(OPTION_INCLUDE_SEGMENT_DETAILS); options.addOption(OPTION_INCLUDE_ONLY_JOB_OUTPUT); options.addOption(OPTION_STORAGE_TYPE); options.addOption(OPTION_ENGINE_TYPE); }
Example 4
Source File: CubeMigrationCrossClusterCLI.java From kylin with Apache License 2.0 | 6 votes |
public CubeMigrationCrossClusterCLI() { OptionGroup realizationOrProject = new OptionGroup(); realizationOrProject.addOption(OPTION_CUBE); realizationOrProject.addOption(OPTION_HYBRID); realizationOrProject.addOption(OPTION_PROJECT); realizationOrProject.addOption(OPTION_All); realizationOrProject.setRequired(true); options = new Options(); options.addOption(OPTION_KYLIN_URI_SRC); options.addOption(OPTION_KYLIN_URI_DST); options.addOption(OPTION_FS_HA_ENABLED_CODE); options.addOption(OPTION_UPDATE_MAPPING); options.addOptionGroup(realizationOrProject); options.addOption(OPTION_DST_HIVE_CHECK); options.addOption(OPTION_SCHEMA_ONLY); options.addOption(OPTION_OVERWRITE); options.addOption(OPTION_EXECUTE); options.addOption(OPTION_COPROCESSOR_PATH); options.addOption(OPTION_DISTCP_JOB_QUEUE); options.addOption(OPTION_THREAD_NUM); options.addOption(OPTION_DISTCP_JOB_MEMORY); }
Example 5
Source File: CommandLineParser.java From DroidRA with GNU Lesser General Public License v2.1 | 6 votes |
/** * Populates the default command line arguments that are common to all analyses. * * @param options The command line options object that should be modified. */ private void parseDefaultCommandLineArguments(Options options) { OptionGroup modelGroup = new OptionGroup(); modelGroup.addOption(Option.builder("model").desc("Path to the model directory.").hasArg() .argName("model directory").build()); modelGroup.addOption(Option.builder("cmodel").desc("Path to the compiled model.").hasArg() .argName("compiled model").build()); modelGroup.setRequired(false); options.addOptionGroup(modelGroup); options.addOption(Option.builder("cp").desc("The classpath for the analysis.").hasArg() .argName("classpath").required().longOpt("classpath").build()); options.addOption(Option.builder("in").desc("The input code for the analysis.").hasArg() .argName("input").required().longOpt("input").build()); options.addOption(Option.builder("out").desc("The output directory or file.").hasArg() .argName("output").longOpt("output").build()); options.addOption(Option.builder("traversemodeled").desc("Propagate through modeled classes.") .hasArg(false).build()); options.addOption("modeledtypesonly", false, "Only infer modeled types."); options.addOption(Option.builder("threadcount") .desc("The maximum number of threads that should be used.").hasArg() .argName("thread count").type(Number.class).build()); }
Example 6
Source File: ZooKeeperMigratorMain.java From localization_nifi with Apache License 2.0 | 6 votes |
private static Options createOptions() { final Options options = new Options(); options.addOption(OPTION_ZK_MIGRATOR_HELP); options.addOption(OPTION_ZK_ENDPOINT); options.addOption(OPTION_ZK_AUTH_INFO); options.addOption(OPTION_FILE); options.addOption(OPTION_IGNORE_SOURCE); final OptionGroup optionGroupAuth = new OptionGroup().addOption(OPTION_ZK_AUTH_INFO).addOption(OPTION_ZK_KRB_CONF_FILE); optionGroupAuth.setRequired(false); options.addOptionGroup(optionGroupAuth); final OptionGroup optionGroupReadWrite = new OptionGroup().addOption(OPTION_RECEIVE).addOption(OPTION_SEND); optionGroupReadWrite.setRequired(true); options.addOptionGroup(optionGroupReadWrite); return options; }
Example 7
Source File: CubeMetaExtractor.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public CubeMetaExtractor() { super(); OptionGroup realizationOrProject = new OptionGroup(); realizationOrProject.addOption(OPTION_CUBE); realizationOrProject.addOption(OPTION_PROJECT); realizationOrProject.addOption(OPTION_HYBRID); realizationOrProject.addOption(OPTION_All_PROJECT); realizationOrProject.setRequired(true); options.addOptionGroup(realizationOrProject); options.addOption(OPTION_INCLUDE_SEGMENTS); options.addOption(OPTION_INCLUDE_JOB); options.addOption(OPTION_INCLUDE_SEGMENT_DETAILS); options.addOption(OPTION_INCLUDE_ONLY_JOB_OUTPUT); options.addOption(OPTION_STORAGE_TYPE); options.addOption(OPTION_ENGINE_TYPE); }
Example 8
Source File: ZkGrep.java From helix with Apache License 2.0 | 5 votes |
@SuppressWarnings("static-access") private static Options constructCommandLineOptions() { Option zkCfgOption = OptionBuilder.hasArgs(1).isRequired(false).withLongOpt(zkCfg).withArgName("zoo.cfg") .withDescription("provide zoo.cfg").create(); Option patternOption = OptionBuilder.hasArgs().isRequired(true).withLongOpt(pattern) .withArgName("grep-patterns...").withDescription("provide patterns (required)") .create(); Option betweenOption = OptionBuilder.hasArgs(2).isRequired(false).withLongOpt(between) .withArgName("t1 t2 (timestamp in ms or yyMMdd_hhmmss_SSS)") .withDescription("grep between t1 and t2").create(); Option byOption = OptionBuilder.hasArgs(1).isRequired(false).withLongOpt(by) .withArgName("t (timestamp in ms or yyMMdd_hhmmss_SSS)").withDescription("grep by t") .create(); OptionGroup group = new OptionGroup(); group.setRequired(true); group.addOption(betweenOption); group.addOption(byOption); Options options = new Options(); options.addOption(zkCfgOption); options.addOption(patternOption); options.addOptionGroup(group); return options; }
Example 9
Source File: CliToolConfig.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override void populate(Options options) { OptionGroup verbosityGroup = new OptionGroup(); verbosityGroup.setRequired(false); verbosityGroup.addOption(new OptionBuilder("s", "silent").required(false).build()); verbosityGroup.addOption(new OptionBuilder("v", "verbose").required(false).build()); options.addOptionGroup(verbosityGroup); }
Example 10
Source File: HBaseUsageExtractor.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public HBaseUsageExtractor() { super(); packageType = "hbase"; OptionGroup realizationOrProject = new OptionGroup(); realizationOrProject.addOption(OPTION_CUBE); realizationOrProject.addOption(OPTION_PROJECT); realizationOrProject.setRequired(true); options.addOptionGroup(realizationOrProject); conf = HBaseConfiguration.create(); hbaseRootDir = conf.get("hbase.rootdir"); cachedHMasterUrl = getHBaseMasterUrl(); }
Example 11
Source File: DashboardArguments.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
private static Options configureOptions() { Options options = new Options(); OptionGroup inputGroup = new OptionGroup(); inputGroup.setRequired(true); Option inputFileOption = Option.builder("f").longOpt("bom-file").hasArg().desc("File to a BOM (pom.xml)").build(); inputGroup.addOption(inputFileOption); Option inputCoordinatesOption = Option.builder("c") .longOpt("bom-coordinates") .hasArg() .desc( "Maven coordinates of a BOM. For example, com.google.cloud:libraries-bom:1.0.0") .build(); inputGroup.addOption(inputCoordinatesOption); Option versionlessCoordinatesOption = Option.builder("a") .longOpt("all-versions") .hasArg() .desc( "Maven coordinates of a BOM without version. " + "For example, com.google.cloud:libraries-bom") .build(); inputGroup.addOption(versionlessCoordinatesOption); options.addOptionGroup(inputGroup); return options; }
Example 12
Source File: HBaseUsageExtractor.java From kylin with Apache License 2.0 | 5 votes |
public HBaseUsageExtractor() { super(); packageType = "hbase"; OptionGroup realizationOrProject = new OptionGroup(); realizationOrProject.addOption(OPTION_CUBE); realizationOrProject.addOption(OPTION_PROJECT); realizationOrProject.setRequired(true); options.addOptionGroup(realizationOrProject); conf = HBaseConfiguration.create(); hbaseRootDir = conf.get("hbase.rootdir"); cachedHMasterUrl = getHBaseMasterUrl(); }
Example 13
Source File: SentrySchemaTool.java From incubator-sentry with Apache License 2.0 | 4 votes |
@SuppressWarnings("static-access") private static void initOptions(Options cmdLineOptions) { Option help = new Option("help", "print this message"); Option upgradeOpt = new Option("upgradeSchema", "Schema upgrade"); Option upgradeFromOpt = OptionBuilder.withArgName("upgradeFrom").hasArg(). withDescription("Schema upgrade from a version"). create("upgradeSchemaFrom"); Option initOpt = new Option("initSchema", "Schema initialization"); Option initToOpt = OptionBuilder.withArgName("initTo").hasArg(). withDescription("Schema initialization to a version"). create("initSchemaTo"); Option infoOpt = new Option("info", "Show config and schema details"); OptionGroup optGroup = new OptionGroup(); optGroup.addOption(upgradeOpt).addOption(initOpt). addOption(help).addOption(upgradeFromOpt). addOption(initToOpt).addOption(infoOpt); optGroup.setRequired(true); Option userNameOpt = OptionBuilder.withArgName("user") .hasArg() .withDescription("Override config file user name") .create("userName"); Option passwdOpt = OptionBuilder.withArgName("password") .hasArg() .withDescription("Override config file password") .create("passWord"); Option dbTypeOpt = OptionBuilder.withArgName("databaseType") .hasArg().withDescription("Metastore database type [" + SentrySchemaHelper.DB_DERBY + "," + SentrySchemaHelper.DB_MYSQL + "," + SentrySchemaHelper.DB_ORACLE + "," + SentrySchemaHelper.DB_POSTGRACE + "," + SentrySchemaHelper.DB_DB2 + "]") .create("dbType"); Option dbOpts = OptionBuilder.withArgName("databaseOpts") .hasArgs().withDescription("Backend DB specific options") .create("dbOpts"); Option dryRunOpt = new Option("dryRun", "list SQL scripts (no execute)"); Option verboseOpt = new Option("verbose", "only print SQL statements"); Option configOpt = OptionBuilder.withArgName("confName").hasArgs() .withDescription("Sentry Service configuration file").isRequired(true) .create(ServiceConstants.ServiceArgs.CONFIG_FILE_LONG); cmdLineOptions.addOption(help); cmdLineOptions.addOption(dryRunOpt); cmdLineOptions.addOption(userNameOpt); cmdLineOptions.addOption(passwdOpt); cmdLineOptions.addOption(dbTypeOpt); cmdLineOptions.addOption(verboseOpt); cmdLineOptions.addOption(dbOpts); cmdLineOptions.addOption(configOpt); cmdLineOptions.addOptionGroup(optGroup); }
Example 14
Source File: CommandLineOptions.java From vespa with Apache License 2.0 | 4 votes |
@SuppressWarnings("AccessStaticViaInstance") private static Options createOptions() { Options options = new Options(); options.addOption(Option.builder("h") .hasArg(false) .desc("Show this syntax page.") .longOpt(HELP_OPTION) .build()); options.addOption(Option.builder("d") .hasArg(false) .desc("Dump list of documents for all buckets matching the selection command.") .longOpt(DUMP_OPTION) .build()); options.addOption(Option.builder("r") .hasArg(true) .desc("Route to send the messages to, usually the name of the storage cluster.") .argName("route") .longOpt(ROUTE_OPTION) .build()); options.addOption(Option.builder("s") .hasArg(true) .desc("Stat buckets within the given bucket space. If not provided, '" + FixedBucketSpaces.defaultSpace() + "' is used.") .argName("space") .longOpt(BUCKET_SPACE_OPTION) .build()); // A group of mutually exclusive options for user, group, bucket, gid and document. OptionGroup optionGroup = new OptionGroup(); optionGroup.setRequired(false); optionGroup.addOption(Option.builder("u") .hasArg(true) .desc("Dump list of buckets that can contain the given user.") .argName("userid") .longOpt(USER_OPTION) .build()); optionGroup.addOption(Option.builder("g") .hasArg(true) .desc("Dump list of buckets that can contain the given group.") .argName("groupid") .longOpt(GROUP_OPTION) .build()); optionGroup.addOption(Option.builder("b") .hasArg(true) .desc("Dump list of buckets that are contained in the given bucket, or that contain it.") .argName("bucketid") .longOpt(BUCKET_OPTION) .build()); optionGroup.addOption(Option.builder("l") .hasArg(true) .desc("Dump information about one specific document, as given by the GID (implies --dump).") .argName("globalid") .longOpt(GID_OPTION) .build()); optionGroup.addOption(Option.builder("o") .hasArg(true) .desc("Dump information about one specific document (implies --dump).") .argName("docid") .longOpt(DOCUMENT_OPTION) .build()); options.addOptionGroup(optionGroup); return options; }
Example 15
Source File: IntegrationTestUtil.java From helix with Apache License 2.0 | 4 votes |
@SuppressWarnings("static-access") static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options information") .create(); Option zkSvrOption = OptionBuilder.hasArgs(1).isRequired(true).withArgName("zookeeperAddress") .withLongOpt(zkSvr).withDescription("Provide zookeeper-address").create(); Option timeoutOption = OptionBuilder.hasArgs(1).isRequired(true).withArgName("timeout") .withLongOpt(timeout).withDescription("Provide timeout (in ms)").create(); Option verifyExternalViewOption = OptionBuilder.hasArgs().isRequired(false).withArgName("clusterName node1 node2..") .withLongOpt(verifyExternalView).withDescription("Verify external-view").create(); Option verifyClusterStateOption = OptionBuilder.hasArgs().isRequired(false).withArgName("clusterName") .withLongOpt(verifyClusterState).withDescription("Verify Bestpossible ClusterState").create(); Option verifyLiveNodesOption = OptionBuilder.hasArg().isRequired(false).withArgName("clusterName node1, node2..") .withLongOpt(verifyLiveNodes).withDescription("Verify live-nodes").create(); Option readZNodeOption = OptionBuilder.hasArgs(1).isRequired(false).withArgName("zkPath").withLongOpt(readZNode) .withDescription("Read znode").create(); Option readLeaderOption = OptionBuilder.hasArgs(1).isRequired(false).withArgName("clusterName") .withLongOpt(readLeader).withDescription("Read cluster controller").create(); OptionGroup optGroup = new OptionGroup(); optGroup.setRequired(true); optGroup.addOption(verifyExternalViewOption); optGroup.addOption(verifyClusterStateOption); optGroup.addOption(verifyLiveNodesOption); optGroup.addOption(readZNodeOption); optGroup.addOption(readLeaderOption); Options options = new Options(); options.addOption(helpOption); options.addOption(zkSvrOption); options.addOption(timeoutOption); options.addOptionGroup(optGroup); return options; }
Example 16
Source File: GridVmNodesStarter.java From ignite with Apache License 2.0 | 4 votes |
/** * Creates cli options. * * @return Command line options */ private static Options createOptions() { Options options = new Options(); OptionGroup grp = new OptionGroup(); grp.setRequired(true); Option cfg = new Option(OPTION_CFG, null, true, "path to Spring XML configuration file."); cfg.setArgName("file"); Option n = new Option(null, OPTION_N, true, "nodes count."); n.setValueSeparator('='); n.setType(Integer.class); grp.addOption(cfg); grp.addOption(n); options.addOptionGroup(grp); return options; }
Example 17
Source File: DMLOptions.java From systemds with Apache License 2.0 | 4 votes |
@SuppressWarnings("static-access") private static Options createCLIOptions() { Options options = new Options(); Option nvargsOpt = OptionBuilder.withArgName("key=value") .withDescription("parameterizes DML script with named parameters of the form <key=value>; <key> should be a valid identifier in DML/PyDML") .hasArgs().create("nvargs"); Option argsOpt = OptionBuilder.withArgName("argN") .withDescription("specifies positional parameters; first value will replace $1 in DML program; $2 will replace 2nd and so on") .hasArgs().create("args"); Option configOpt = OptionBuilder.withArgName("filename") .withDescription("uses a given configuration file (can be on local/hdfs/gpfs; default values in SystemDS-config.xml") .hasArg().create("config"); Option cleanOpt = OptionBuilder.withDescription("cleans up all SystemDS working directories (FS, DFS); all other flags are ignored in this mode.") .create("clean"); Option statsOpt = OptionBuilder.withArgName("count") .withDescription("monitors and reports summary execution statistics; heavy hitter <count> is 10 unless overridden; default off") .hasOptionalArg().create("stats"); Option memOpt = OptionBuilder.withDescription("monitors and reports max memory consumption in CP; default off") .create("mem"); Option explainOpt = OptionBuilder.withArgName("level") .withDescription("explains plan levels; can be 'hops' / 'runtime'[default] / 'recompile_hops' / 'recompile_runtime'") .hasOptionalArg().create("explain"); Option execOpt = OptionBuilder.withArgName("mode") .withDescription("sets execution mode; can be 'hadoop' / 'singlenode' / 'hybrid'[default] / 'HYBRID' / 'spark'") .hasArg().create("exec"); Option gpuOpt = OptionBuilder.withArgName("force") .withDescription("uses CUDA instructions when reasonable; set <force> option to skip conservative memory estimates and use GPU wherever possible; default off") .hasOptionalArg().create("gpu"); Option debugOpt = OptionBuilder.withDescription("runs in debug mode; default off") .create("debug"); Option pythonOpt = OptionBuilder.withDescription("parses Python-like DML") .create("python"); Option fileOpt = OptionBuilder.withArgName("filename") .withDescription("specifies dml/pydml file to execute; path can be local/hdfs/gpfs (prefixed with appropriate URI)") .isRequired().hasArg().create("f"); Option scriptOpt = OptionBuilder.withArgName("script_contents") .withDescription("specified script string to execute directly") .isRequired().hasArg().create("s"); Option helpOpt = OptionBuilder.withDescription("shows usage message") .create("help"); Option lineageOpt = OptionBuilder.withDescription("computes lineage traces") .hasOptionalArgs().create("lineage"); Option fedOpt = OptionBuilder.withDescription("starts a federated worker with the given argument as the port.") .hasOptionalArg().create("w"); options.addOption(configOpt); options.addOption(cleanOpt); options.addOption(statsOpt); options.addOption(memOpt); options.addOption(explainOpt); options.addOption(execOpt); options.addOption(gpuOpt); options.addOption(debugOpt); options.addOption(pythonOpt); options.addOption(lineageOpt); options.addOption(fedOpt); // Either a clean(-clean), a file(-f), a script(-s) or help(-help) needs to be specified OptionGroup fileOrScriptOpt = new OptionGroup() .addOption(scriptOpt) .addOption(fileOpt) .addOption(cleanOpt) .addOption(helpOpt) .addOption(fedOpt); fileOrScriptOpt.setRequired(true); options.addOptionGroup(fileOrScriptOpt); // Either -args or -nvargs options.addOptionGroup(new OptionGroup() .addOption(nvargsOpt).addOption(argsOpt)); options.addOption(helpOpt); return options; }
Example 18
Source File: DMLOptions.java From systemds with Apache License 2.0 | 4 votes |
@SuppressWarnings("static-access") private static Options createCLIOptions() { Options options = new Options(); Option nvargsOpt = OptionBuilder.withArgName("key=value") .withDescription("parameterizes DML script with named parameters of the form <key=value>; <key> should be a valid identifier in DML/PyDML") .hasArgs().create("nvargs"); Option argsOpt = OptionBuilder.withArgName("argN") .withDescription("specifies positional parameters; first value will replace $1 in DML program; $2 will replace 2nd and so on") .hasArgs().create("args"); Option configOpt = OptionBuilder.withArgName("filename") .withDescription("uses a given configuration file (can be on local/hdfs/gpfs; default values in SystemDS-config.xml") .hasArg().create("config"); Option cleanOpt = OptionBuilder.withDescription("cleans up all SystemDS working directories (FS, DFS); all other flags are ignored in this mode.") .create("clean"); Option statsOpt = OptionBuilder.withArgName("count") .withDescription("monitors and reports summary execution statistics; heavy hitter <count> is 10 unless overridden; default off") .hasOptionalArg().create("stats"); Option memOpt = OptionBuilder.withDescription("monitors and reports max memory consumption in CP; default off") .create("mem"); Option explainOpt = OptionBuilder.withArgName("level") .withDescription("explains plan levels; can be 'hops' / 'runtime'[default] / 'recompile_hops' / 'recompile_runtime'") .hasOptionalArg().create("explain"); Option execOpt = OptionBuilder.withArgName("mode") .withDescription("sets execution mode; can be 'hadoop' / 'singlenode' / 'hybrid'[default] / 'HYBRID' / 'spark'") .hasArg().create("exec"); Option gpuOpt = OptionBuilder.withArgName("force") .withDescription("uses CUDA instructions when reasonable; set <force> option to skip conservative memory estimates and use GPU wherever possible; default off") .hasOptionalArg().create("gpu"); Option debugOpt = OptionBuilder.withDescription("runs in debug mode; default off") .create("debug"); Option pythonOpt = OptionBuilder.withDescription("parses Python-like DML") .create("python"); Option fileOpt = OptionBuilder.withArgName("filename") .withDescription("specifies dml/pydml file to execute; path can be local/hdfs/gpfs (prefixed with appropriate URI)") .isRequired().hasArg().create("f"); Option scriptOpt = OptionBuilder.withArgName("script_contents") .withDescription("specified script string to execute directly") .isRequired().hasArg().create("s"); Option helpOpt = OptionBuilder.withDescription("shows usage message") .create("help"); Option lineageOpt = OptionBuilder.withDescription("computes lineage traces") .hasOptionalArgs().create("lineage"); Option fedOpt = OptionBuilder.withDescription("starts a federated worker with the given argument as the port.") .hasOptionalArg().create("w"); Option checkPrivacy = OptionBuilder .withDescription("Check which privacy constraints are loaded and checked during federated execution") .create("checkPrivacy"); options.addOption(configOpt); options.addOption(cleanOpt); options.addOption(statsOpt); options.addOption(memOpt); options.addOption(explainOpt); options.addOption(execOpt); options.addOption(gpuOpt); options.addOption(debugOpt); options.addOption(pythonOpt); options.addOption(lineageOpt); options.addOption(fedOpt); options.addOption(checkPrivacy); // Either a clean(-clean), a file(-f), a script(-s) or help(-help) needs to be specified OptionGroup fileOrScriptOpt = new OptionGroup() .addOption(scriptOpt) .addOption(fileOpt) .addOption(cleanOpt) .addOption(helpOpt) .addOption(fedOpt); fileOrScriptOpt.setRequired(true); options.addOptionGroup(fileOrScriptOpt); // Either -args or -nvargs options.addOptionGroup(new OptionGroup() .addOption(nvargsOpt).addOption(argsOpt)); options.addOption(helpOpt); return options; }
Example 19
Source File: MigrationHelper.java From java-samples with Apache License 2.0 | 4 votes |
static Options buildOptions() { Options options = new Options(); Option generateReport = Option.builder(MigrationOptions.GENERATE_REPORT.option) .longOpt(MigrationOptions.GENERATE_REPORT.longOpt) .desc(MigrationOptions.GENERATE_REPORT.description) .build(); Option duplicateHolds = Option.builder(MigrationOptions.DUPLICATE_HOLDS.option) .longOpt(MigrationOptions.DUPLICATE_HOLDS.longOpt) .desc(MigrationOptions.DUPLICATE_HOLDS.description) .build(); Option reportFile = Option.builder(MigrationOptions.REPORT_FILE.option) .required() .hasArg() .longOpt(MigrationOptions.REPORT_FILE.longOpt) .argName("reportfile") .desc(MigrationOptions.REPORT_FILE.description) .build(); Option errorFile = Option.builder(MigrationOptions.ERROR_FILE.option) .required() .hasArg() .longOpt(MigrationOptions.ERROR_FILE.longOpt) .argName("errorfile") .desc(MigrationOptions.ERROR_FILE.description) .build(); Option includeRoom = Option.builder(MigrationOptions.INCLUDE_ROOMS.option) .longOpt(MigrationOptions.INCLUDE_ROOMS.longOpt) .argName(MigrationOptions.INCLUDE_ROOMS.description) .desc(MigrationOptions.INCLUDE_ROOMS.description) .build(); options.addOption(reportFile); options.addOption(errorFile); options.addOption(includeRoom); OptionGroup optionGroup = new OptionGroup(); optionGroup.addOption(generateReport).addOption(duplicateHolds).addOption(helpOption); optionGroup.setRequired(true); options.addOptionGroup(optionGroup); return options; }
Example 20
Source File: GridRandomCommandLineLoader.java From ignite with Apache License 2.0 | 2 votes |
/** * Creates cli options. * * @return Command line options */ private static Options createOptions() { Options options = new Options(); Option help = new Option(OPTION_HELP, "print this message"); Option cfg = new Option(null, OPTION_CFG, true, "path to Spring XML configuration file."); cfg.setValueSeparator('='); cfg.setType(String.class); Option minTtl = new Option(null, OPTION_MIN_TTL, true, "node minimum time to live."); minTtl.setValueSeparator('='); minTtl.setType(Long.class); Option maxTtl = new Option(null, OPTION_MAX_TTL, true, "node maximum time to live."); maxTtl.setValueSeparator('='); maxTtl.setType(Long.class); Option duration = new Option(null, OPTION_DURATION, true, "run timeout."); duration.setValueSeparator('='); duration.setType(Long.class); Option log = new Option(null, OPTION_LOG_CFG, true, "path to log4j configuration file."); log.setValueSeparator('='); log.setType(String.class); options.addOption(help); OptionGroup grp = new OptionGroup(); grp.setRequired(true); grp.addOption(cfg); grp.addOption(minTtl); grp.addOption(maxTtl); grp.addOption(duration); grp.addOption(log); options.addOptionGroup(grp); return options; }