@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("--confirm-delete-everything") .action(Arguments.storeTrue()) .required(true) .help("indicate you understand this deletes everything in your database"); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-l", "--list") .dest("list") .action(Arguments.storeTrue()) .setDefault(Boolean.FALSE) .help("list all open locks"); subparser.addArgument("-r", "--force-release") .dest("release") .action(Arguments.storeTrue()) .setDefault(Boolean.FALSE) .help("forcibly release all open locks"); }
public static void main(String[] args) throws Exception { ArgumentParser parser = ArgumentParsers.newArgumentParser("ImpressionsToInfluxDb") .defaultHelp(true) .description("Read Seldon impressions and send stats to influx db"); parser.addArgument("-t", "--topic").setDefault("actions").help("Kafka topic to read from"); parser.addArgument("-c", "--client").required(true).help("Client to run item similarity"); parser.addArgument("-o", "--output-topic").required(true).help("Output topic"); parser.addArgument("-k", "--kafka").setDefault("localhost:9092").help("Kafka server and port"); parser.addArgument("-z", "--zookeeper").setDefault("localhost:2181").help("Zookeeper server and port"); parser.addArgument("-w", "--window-secs").type(Integer.class).setDefault(3600*5).help("streaming window size in secs, -1 means ignore"); parser.addArgument("-u", "--window-processed").type(Integer.class).setDefault(-1).help("streaming window size in processed count, -1 means ignore"); parser.addArgument("--output-poll-secs").type(Integer.class).setDefault(60).help("output timer polling period in secs"); parser.addArgument("--hashes").type(Integer.class).setDefault(100).help("number of hashes"); parser.addArgument("-m", "--min-activity").type(Integer.class).setDefault(200).help("min activity"); parser.addArgument("-p", "--parse-date-method").choices("json-time","json-utc","system").setDefault("json-time").help("min activity"); Namespace ns = null; try { ns = parser.parseArgs(args); ItemSimilarityProcessor processor = new ItemSimilarityProcessor(ns); processor.process(ns); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } }
/** * Adds the configuration file argument for the configured command. * @param subparser The subparser to register the argument on * @return the register argument */ protected Argument addFileArgument(Subparser subparser) { return subparser.addArgument("file") .nargs("?") .help("application configuration file"); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-c", "--count") .dest("count") .type(Integer.class) .help("limit script to the specified number of pending change sets"); subparser.addArgument("-i", "--include") .action(Arguments.append()) .dest("contexts") .help("include change sets from the given context"); }
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("tag-name") .dest("tag-name") .nargs(1) .required(true) .help("The tag name"); }
System.out.println(Lists.asList(args)); ArgumentParser argParser = ArgumentParsers.newArgumentParser("Full install set", true, "-").description("Compares deployed and built ears and makes set of ears for installation"); argParser.addArgument("-deployed").type(String.class).required(true).help("Path to deployed ears. Ex: /tib/app/jenkins2/home/userContent/TIBCO/_deployed/ENV_EAI_TST"); argParser.addArgument("-built").type(String.class).required(true).help("Path to built ears. Ex: /tib/app/jenkins2/home/userContent/TIBCO/R180217_miloslav"); argParser.addArgument("-init-built").type(String.class).required(true).help("Path to initially built ears: Ex: /tib/app/jenkins2/workspace/workspace/R180217_miloslav/init-built"); argParser.addArgument("-domain").type(String.class).required(true).help("Name of domain: Ex: ENV_EAI_TST2"); argParser.addArgument("-env").type(String.class).required(true).help("Name of env, usually same as domain except TED instance, where it is extended with TED isntance name: Ex: ENV_EAI_TED_cardik"); argParser.addArgument("-tibcohome").type(String.class).required(true).help("Path to tibco home. Ex: /tib/app/tibco"); argParser.addArgument("-output").type(String.class).required(true).help("Output path - changed EARs will be copied there. Ex: /tib/app/jenkins2/home/userContent/TIBCO/R180217_miloslav/ENV_EAI_TST2"); argParser.addArgument("-earmask").type(String.class).required(false).help("EAR mask - restricts comparing only for given mask. Ex: *"); Path deployed = Paths.get(res.getString("deployed")); Path built = Paths.get(res.getString("built")); Path initBuilt = Paths.get(res.getString("init_built")); String domain = res.get("domain"); String env = res.get("env");
.description("This example is to demonstrate kafka producer capabilities"); parser.addArgument("--bootstrap.servers").action(store()) .required(true) .type(String.class) .metavar("BROKER-LIST") .help("comma separated broker list"); parser.addArgument("--topic").action(store()) .required(true) .type(String.class) .metavar("TOPIC") .help("produce messages to this topic"); parser.addArgument("--serializer").action(store()) .required(false) .setDefault("byte") .type(String.class) .choices(Arrays.asList("byte", "kryo")) .metavar("BYTE/KRYO") .help("use byte array or kryo serializer");
public DeploymentGroupCreateCommand(final Subparser parser) { super(parser); parser.help("create a deployment group"); nameArg = parser.addArgument("name") .required(true) .help("Deployment group name"); hostSelectorsArg = parser.addArgument("host_selectors") .action(append()) .setDefault(Lists.newArrayList()) .nargs("+") .help("Host selector expression. Hosts matching this expression will be part of the " + "deployment-group. Multiple conditions can be specified, separated by spaces (as " + "separate arguments). If multiple conditions are given, all must be fulfilled. " + "Operators supported are =, !=, in and notin. Example: foo=bar baz!=qux"); quietArg = parser.addArgument("-q") .action(storeTrue()) .help("only print job id"); }
serverParser.addArgument("-p", "--port").required(true) .help("Port to be assigned to the server.\n"); serverParser.addArgument("-m", "--model").required(true) .help("It is required to provide a model to perform POS tagging."); this.serverParser.addArgument("-lm", "--lemmatizerModel") .required(true) .help("It is required to provide a lemmatizer model."); serverParser.addArgument("-l", "--language") .choices("de", "en", "es", "eu", "fr", "gl", "it", "nl") .required(true) .help("Choose a language to perform annotation with ixa-pipe-pos."); serverParser.addArgument("--beamSize").required(false) .setDefault(DEFAULT_BEAM_SIZE) .help("Choose beam size for decoding, it defaults to 3."); serverParser.addArgument("-o", "--outputFormat").required(false) .choices("naf", "conll") .setDefault(Flags.DEFAULT_OUTPUT_FORMAT) .help("Choose output format; it defaults to NAF.\n"); serverParser.addArgument("-mw", "--multiwords") .action(Arguments.storeTrue()) .help("Use to detect and process multiwords.\n"); serverParser.addArgument("-d", "--dictag") .action(Arguments.storeTrue()) .help("Post process POS tagger output with a monosemic dictionary.\n"); serverParser.addArgument("-a","--allMorphology") .action(Arguments.storeTrue()) .help("Print all the POS tags and lemmas before disambiguation.\n");
public static void main(String args[]) throws Exception { ArgumentParser parser = ArgumentParsers.newArgumentParser("MainClass", true); parser.addArgument("-r", "--train").type(String.class) .help("The training file in CoNLL format").setDefault(""); parser.addArgument("-t", "--test").help("The test file in CoNLL format"); parser.addArgument("-c", "--config").help("The SL configuration file") .setDefault("config/StructuredPerceptron.config"); parser.addArgument("-m", "--model").help("The model output file").setDefault("out.model"); parser.addArgument("-p", "--pos").help("The type of PoS tags to use") .choices("gold", "auto").setDefault("auto"); parser.addArgument("-o", "--offset").type(Integer.class) .help("The offset of the pos/head/dep index for the CoNLL train/test files") .setDefault(0); parser.addArgument("-a", "--annotate") .type(String.class) .help("Annotate text file (one sentence per line) and print the output to the command line") .setDefault(""); Namespace ns = parser.parseArgs(args); useGoldPOS = ns.getString("pos").equals("gold"); logger.info("Using {} PoS tags", ns.getString("pos")); conllIndexOffset = ns.getInt("offset"); if (!ns.getString("train").isEmpty()) { logger.info("Using {} configuration", ns.getString("config"));
/** * Initialize the arg parser for the Sort sub command * * @param subparsers The Subparsers object to attach the new Subparser to */ @Override public void intializeSubCommand( Subparsers subparsers ) { Subparser sortParser = subparsers.addParser( "sort" ) .description( "Jolt CLI Sort Tool. This tool will ingest one JSON input (from a file or standard input) and " + "perform the Jolt sort operation on it. The sort order is standard alphabetical ascending, with a " + "special case for \"~\" prefixed keys to be bumped to the top. The program will return an exit code " + "of 0 if the sort operation is performed successfully or a 1 if an error is encountered." ) .defaultHelp( true ); sortParser.addArgument( "input" ).help( "File path to the input JSON that the sort operation should be performed on. " + "This file should contain valid JSON. " + "If this argument is not specified then standard input will be used." ) .type( Arguments.fileType().verifyExists().verifyIsFile().verifyCanRead() ) .nargs( "?" ).setDefault( (File) null ).required( false ); // these last two method calls make input optional sortParser.addArgument( "-u" ).help( "Turns off pretty print for the output. Output will be raw json with no formatting." ) .action( Arguments.storeTrue() ); }
+ "by specifying the option path and value as an optional argument, e.g. --cluster.node.id node-1"); parser.addArgument("--member", "-m") .type(String.class) .nargs("?") .required(false) .help("The local member identifier, used in intra-cluster communication."); parser.addArgument("--address", "-a") .type(addressArgumentType) .metavar("HOST:PORT") .nargs("?") .required(false) .help("The address for the local member. If no address is specified, the first public interface will be used."); parser.addArgument("--host") .type(String.class) .nargs("?") .required(false) .help("The host on which this member runs, used for host-aware partition management."); parser.addArgument("--rack") .type(String.class) .nargs("?") .required(false) .help("The rack on which this member runs, used for rack-aware partition management."); parser.addArgument("--zone") .type(String.class) .nargs("?") .required(false) .help("The zone in which this member runs, used for zone-aware partition management."); parser.addArgument("--config", "-c") .metavar("CONF|JSON|PROPERTIES")
public static void main(String... args) throws IOException { ArgumentParser parser = ArgumentParsers.newFor("MacroBase SQL").build() .defaultHelp(true) .description("Run MacroBase SQL."); parser.addArgument("-f", "--file").help("Load file with SQL queries to execute"); parser.addArgument("-p", "--paging").type(Arguments.booleanType()).setDefault(false) .help("Turn on paging of results for SQL queries"); final Namespace parsedArgs = parser.parseArgsOrFail(args); final MacroBaseSQLRepl repl = new MacroBaseSQLRepl(parsedArgs.get("paging")); final String asciiArt = Resources .toString(Resources.getResource(ASCII_ART_FILE), Charsets.UTF_8); boolean printedWelcome = false; if (parsedArgs.get("file") != null) { System.out.println(asciiArt); printedWelcome = true; final String queriesFromFile = Files .toString(new File((String) parsedArgs.get("file")), Charsets.UTF_8); repl.executeQueries(queriesFromFile, true); } if (!printedWelcome) { System.out.println(asciiArt); } repl.runRepl(); } }
Subparser subParser = subParsers.addParser("annotate-csv", true).help("Annotate a csv file").setDefault("cmd", handler); subParser.description("Perform annotation of genomic changes given on the command line"); ArgumentGroup requiredGroup = subParser.addArgumentGroup("Required arguments"); requiredGroup.addArgument("-d", "--database").help("Path to database .ser file").required(true); requiredGroup.addArgument("-i", "--input").help("CSV file").required(true); requiredGroup.addArgument("-c", "--chr").type(Integer.class).help("Column of chr (1 based)").required(true); requiredGroup.addArgument("-p", "--pos").type(Integer.class).help("Column of pos (1 based)").required(true); requiredGroup.addArgument("-r", "--ref").type(Integer.class).help("Column of ref (1 based)").required(true); requiredGroup.addArgument("-a", "--alt").type(Integer.class).help("Column of alt (1 based)").required(true); ArgumentGroup optionalGroup = subParser.addArgumentGroup("Additional CSV arguments (optional)"); optionalGroup.addArgument("-t", "--type").type(CSVFormat.Predefined.class) .choices(CSVFormat.Predefined.Default, CSVFormat.Predefined.TDF, CSVFormat.Predefined.RFC4180, CSVFormat.Predefined.Excel, CSVFormat.Predefined.MySQL) .help("Type of csv file. ").setDefault(CSVFormat.Predefined.Default); optionalGroup.addArgument("--header").help("Set if the file contains a header. ").setDefault(false) .action(Arguments.storeTrue()); subParser.epilog(
@Override public void configure(Subparser subparser) { super.configure(subparser); subparser.addArgument("-i", "--include-default") .action(Arguments.storeTrue()) .dest("include-default") .help("Also render the template with the default name"); subparser.addArgument("names").nargs("*"); }
@Override protected void addArgs(final ArgumentParser parser) { httpArg = parser.addArgument("--http") .setDefault("http://0.0.0.0:5801") .help("http endpoint"); .setDefault("http://0.0.0.0:5802") .help("admin http port"); .type(String.class); .type(String.class) .help("ZooKeeper master password (for ZooKeeper ACLs). If the " + ZK_MASTER_PASSWORD_ENVVAR + " environment variable is present this argument is ignored."); .type(Long.class) .setDefault(TimeUnit.DAYS.toHours(14)) .help("In hours. Agents will be automatically de-registered if they are DOWN for more " + "than the specified timeout. To disable reaping, set to 0."); .type(Long.class) .setDefault(-1L) .help("In days. Jobs not deployed anywhere and with a job history showing they were last " + "used before the specified retention time will be removed. " + "This is disabled by default by setting it to a sentinel value of -1."); .action(append()) .setDefault(new ArrayList<>()) .help("The Linux capabilities Helios jobs are allowed to add to their Docker containers. "
subparser.addArgument("-o", "--output") .dest("output") .help("Write output to <file> instead of stdout"); final ArgumentGroup tables = subparser.addArgumentGroup("Tables"); tables.addArgument("--tables") .action(Arguments.storeTrue()) .dest("tables") .help("Check for added or removed tables (default)"); tables.addArgument("--ignore-tables") .action(Arguments.storeFalse()) .dest("tables") .help("Ignore tables"); final ArgumentGroup columns = subparser.addArgumentGroup("Columns"); columns.addArgument("--columns") .action(Arguments.storeTrue()) .dest("columns") .help("Check for added, removed, or modified columns (default)"); columns.addArgument("--ignore-columns") .action(Arguments.storeFalse()) .dest("columns") .help("Ignore columns"); .action(Arguments.storeTrue()) .dest("views") .help("Check for added, removed, or modified views (default)"); views.addArgument("--ignore-views") .action(Arguments.storeFalse())
.action(append()) .help("master endpoints"); .setDefault(new ArrayList<>()) .action(append()) .help("domains"); .setDefault(cliConfig.getSrvName()) .help("master srv name"); .setDefault(System.getProperty("user.name")) .help("username"); .type(Boolean.class) .setDefault(true) .help("enable authentication using access tokens derived from Google Credentials"); .action(Arguments.count()); .action(Arguments.version()) .help("print version"); .action(storeTrue()) .help("json output"); .action(storeTrue()) .help(SUPPRESS); .action(storeTrue())
.setDefault(getHostName()) .help("hostname to register as"); .setDefault(ResolverConfReader.getDomainFromResolverConf("/etc/resolv.conf")) .help("Service registration domain."); .help("Service registry address. Overrides domain."); .type(fileType().verifyExists().verifyCanRead()) .help("Service registration plugin."); .setDefault("localhost:2181") .help("zookeeper connection string"); .type(Integer.class) .setDefault((int) SECONDS.toMillis(60)) .help("zookeeper session timeout"); .type(Integer.class) .setDefault((int) SECONDS.toMillis(15)) .help("zookeeper connection timeout"); .type(String.class) .setDefault((String) null) .help("Optional cluster ID to ensure we are connected to the right cluster"); .setDefault(SUPPRESS) .action(storeTrue()) .help("Do not register this master in zookeeper. Useful for debugging.");