picocli

reset picocli Option field

别说谁变了你拦得住时间么 提交于 2021-01-28 18:59:22
问题 I'm trying to improve performance across many commands as described here. Part of that solution is to reuse the same Commandline object, which is wrapping an object whose fields contain picocli annotations. In some cases, this object needs to be "reset" between uses, as not every field is set by every command, and if some fields have old values from the previous instance, then the wrong behavior results. I tried to use the defaultValue attribute of the @Option annotation, but it did not seem

picocli : dependent arguments in ArgGroup

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 11:35:09
问题 My question is similar, and simpler, to the one asked here. I have three options, -A , -A1 , -A2 (conceptually, part of a single group). The relationships required are these: Neither of these are required -A should be given along with at least one of -A1 or -A2 Both -A1 and -A2 can be given with a single -A In other words: Valid specifications: -A -A1 , -A -A2 , and -A -A1 -A2 Invalid specifications: -A , -A1 , -A2 , and -A1 -A2 This is what I have using two @ArgGroup s: import picocli

PicoCLI: Dependent and Exclusive Arguments mixed

假装没事ソ 提交于 2020-05-31 05:56:25
问题 I am trying to achieve something like the following with PicoCLI: Option 0 (help, verbose) Option A Dependent Option A-1 Dependent Option A-2 Dependent Option A-3 Option B Requires Option A But does not allow any Option A-* I don't know if I can do this setup with PicoCLI tools or if I just check after parsing with custom code. To this state, Option A is in an ArgGroup where Option A is required, but Optioan A-* not. Option B is in a different ArgGroup. I tried to set some things exclusive,

How to improve command performance at runtime?

偶尔善良 提交于 2020-05-29 09:40:54
问题 I have a library with an internal command line that uses picocli 3.9.6. One of these commands is the log command, which works like most loggers, taking a log level and message, and several other options. It gets called a lot in some applications that use the library, and we noticed a huge decrease in performance from when this command was implemented as a one-off vs. when it was switched to picocli. This is true even when the log level is set such that nothing interesting happens. The core

How to improve command performance at runtime?

我怕爱的太早我们不能终老 提交于 2020-05-29 09:38:12
问题 I have a library with an internal command line that uses picocli 3.9.6. One of these commands is the log command, which works like most loggers, taking a log level and message, and several other options. It gets called a lot in some applications that use the library, and we noticed a huge decrease in performance from when this command was implemented as a one-off vs. when it was switched to picocli. This is true even when the log level is set such that nothing interesting happens. The core

Interoperability between Injections in Picocli commands and micronaut

元气小坏坏 提交于 2020-01-16 04:18:11
问题 Defining an @Singleton bean in Micronaut does not @Inject the same instance into Picocli commands. Micronaut offers an integration with Picocli. What is essential done, it seems, is that from the Picocli command, one can start an EmbeddedServer of Micronaut (maybe the problem is already here that Micronaut is started only really started from within Picocli?). When I define a class as singleton via @Singleton, and @Inject it both in a Rest-endpoint of Micronaut and the Picocli command, it

Command Line parser and lack of subcommand and grouping?

瘦欲@ 提交于 2019-12-06 23:47:20
问题 I know this question has been asked many times here and elsewhere before as I am searching for the answer. However, it still puzzles me why the command line parser library doesn't provide this common usage scenario, where I have a group of subcommands, each subcommand has its own set of required and optional arguments. Similar construct can be found in git/svn, though in their case, the subcommand command is a standalone program if I am not mistaken. To summarize, what I am looking for is an

Are there good Java libraries that facilitate building command-line applications? [closed]

妖精的绣舞 提交于 2019-11-28 16:31:16
I need to write a simple command-line application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters... UPDATE Something that has built-in TAB completion would be particularly great. Kevin ORourke I've used the Apache Commons CLI library for command-line argument parsing. It's fairly easy to use and has reasonably good documentation . Which library you choose probably comes down to which style of options you prefer ("--gnu-style" or "-javac-style"). Michael Myers JLine looks helpful. JLine is a

Are there good Java libraries that facilitate building command-line applications? [closed]

主宰稳场 提交于 2019-11-27 09:45:40
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I need to write a simple command-line application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters... UPDATE Something that has built-in TAB completion would be particularly great. 回答1: I've used the Apache

The best CLI parser for Java [duplicate]

安稳与你 提交于 2019-11-27 07:05:23
This question already has an answer here: How do I parse command line arguments in Java? 21 answers What CLI parser for Java is easy to use and more scalable than others? user86614 Here are some of the most popular. They are all pretty feature complete, and having used the top two I can recommend them. Commons CLI http://commons.apache.org/cli/ Java Gems http://code.google.com/p/javagems/ picocli (with colorized usage help and autocomplete) http://picocli.info/ JArgs http://jargs.sourceforge.net/ GetOpt http://www.urbanophile.com/arenn/hacking/download.html EDIT: For completeness, here are