On 2/10/19, P. Ottlinger <pottlin...@apache.org> wrote: > Another way to help out (from the ASF universe) would be: > https://tamaya.apache.org/
I did take a look at tamaya: https://tamaya.apache.org/features.html ~ To me having to go: Configuration config = Configuration.builder() .withDefaultPropertySources() .addPropertySources(new MyCustomPropertySource()) .withDefaultConverters() .build(); is a nonsensical and wasteful overkill. What is this useful for, exactly? Are there actual use cases that kind of coding relates to? ~ On 2/9/19, Remko Popma <remko.po...@gmail.com> wrote: > Picocli has a pluggable default provider > (https://picocli.info/#_default_provider), so it should be fairly > straightforward to implement what you describe. I also spent some time taking a look at picocli and it seems to me like some other kind of an overkill: 13.1. Registering Subcommands Programmatically Subcommands can be registered with the CommandLine.addSubcommand method. You pass in the name of the command and the annotated object to populate with the subcommand options. The specified name is used by the parser to recognize subcommands in the command line arguments. CommandLine commandLine = new CommandLine(new Git()) .addSubcommand("status", new GitStatus()) .addSubcommand("commit", new GitCommit()) .addSubcommand("add", new GitAdd()) .addSubcommand("branch", new GitBranch()) .addSubcommand("checkout", new GitCheckout()) .addSubcommand("clone", new GitClone()) .addSubcommand("diff", new GitDiff()) .addSubcommand("merge", new GitMerge()) .addSubcommand("push", new GitPush()) .addSubcommand("rebase", new GitRebase()) .addSubcommand("tag", new GitTag()); It is strongly recommended that subcommands have a @Command annotation with name and description attributes. ~ > It also has other nice features that you might be interested in, like usage > help with ANSI colors, ... and much > more. Does it come with ANSI colors? Will it also dance the macarena for me? I can't even get what is the point of going through such hoops, when, to me, all you need is for a HashMap<String><String[]> to be returned to you. Users shouldn’t be forced to enter command line arguments in a strict way and order and they should be able to chose the character encoding of the data they will be feeding into a program (you can’t expect for every text on a corpus to be encoded as ASCII or UTF-8).To me this is all there should be to such an utility. Command line arguments are interpreted as strings in the local character encoding anyway, right? You would take it from there, interpreting those sequences of characters with whichever semantics your code needs to define: HashMap<String, String[]> HMSSAr ... String[] aIVal00 = HMSSAr.get("--int-val00"); int iVal00 = (new Integer(aVal00[0])).intValue(); String[] aLVal02 = HMSSAr.get("--long-val02"); long lVal02 = (new Integer(aLVal02[0])).longValue(); String[] aSAr = HMSSAr.get("--strings-ar00"); KCommandObjects KCObjs = new KcommandObjects[aSAr.length]; HashMap<String, Integer> HMSI = new HashMap<String, Integer>(); for(int k = 0; (k < aSAr.length) ;++k){ HMSI.put(aSAr[k], k); KCObjs[k] = Class.forname(aSAr[k]).newInstance(); }// k [0, aSAr.length) . . . I am half way into finishing such a thing, which I thought someone must had done already. Then I will try to integrate with commons-cli or put it out there. I would like to still understand why is it that there exist so many libraries which complicate such matters and why is it that java itself doesn't offer a basic option like the one I have described. lbrtchx --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org