Skip to content

Determine if help was requested using CommandLine in addition to command object itself #145

@kakawait

Description

@kakawait

Do you think is possible to get something like:

public class PicocliCommandLineRunner implements CommandLineRunner {

    private final Object command;

    public PicocliCommandLineRunner(Object command) {
        this.command = command;
    }

    @Override
    public void run(String... args) throws Exception {
        CommandLine cli = new CommandLine(command);
        if (cli.isHelpRequested()) {
            CommandLine.usage(cli.getCommand(), System.out);
            return;
        }
    }
}

Since in my use case, command is injected so I can't control the type of my command!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions