Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JCommander#addCommand does not copy the custom IUsageFormatter #487

Open
fbiville opened this issue Jun 1, 2020 · 0 comments
Open

JCommander#addCommand does not copy the custom IUsageFormatter #487

fbiville opened this issue Jun 1, 2020 · 0 comments

Comments

@fbiville
Copy link

fbiville commented Jun 1, 2020

It seems currently impossible to have a custom IUsageFormatter that propagates to commands:

Here is the current stable version of the canonical addCommand (v1.78).

    public void addCommand(String name, Object object, String... aliases) {
        JCommander jc = new JCommander(options);
        jc.addObject(object);
        jc.createDescriptions();
        jc.setProgramName(name, aliases);
        ProgramName progName = jc.programName;
        commands.put(progName, jc);
        // aliases [...]
    }

Every added command will be associated with a JCommander instance set with DefaultUsageFormatter.

I assume the fix would consist in setting the custom IUsageFormatter in the associated JCommander.Options instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant