Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Switch off Args4j Command Line Processing #16

Closed
romeara opened this issue Nov 20, 2019 · 1 comment
Closed

Switch off Args4j Command Line Processing #16

romeara opened this issue Nov 20, 2019 · 1 comment
Assignees

Comments

@romeara
Copy link
Member

romeara commented Nov 20, 2019

Args4j, based on this issue, appears to be abandoned.

The recommended upgrade path appears to be a library called picocli, with these resources:

In addition, some multi-command stuff:

@romeara romeara self-assigned this Jan 21, 2020
@romeara
Copy link
Member Author

romeara commented Jan 21, 2020

The Maven coordinate for the library is info.picocli:picocli. An example of a multi-command app could be:

public class CommandLineInterface {

    public static void main(String[] args) throws Exception {
        new CommandLine(new ContainerCommand())
                .addSubcommand(new FirstCommand())
                .execute(args);
    }

    @Command(mixinStandardHelpOptions = true)
    public static class ContainerCommand implements Runnable {

        @Override
        public void run() {
            // Empty, this just creates a reasonable command setup - this is the equivalent to something like "git" in git commands
        }

    }

    @Command(description = "...", name = "method-uses", mixinStandardHelpOptions = true)
    public static class FirstCommand implements Callable<Void> {

        @ParentCommand
        private ContainerCommand containerCommand;

        @Option(names = { "--source", "-s" }, description = "source dir", required = true)
        private String directory;

        @Option(names = { "--output", "-o" }, description = "File to output results to", required = false)
        private String outputFile;

        @Override
        public Void call() throws Exception {
            // Do stuff
        }
    }

}

romeara added a commit that referenced this issue Jan 21, 2020
…-library

Resolves GH-16: Switch off abandoned CLI parsing library to picocli
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant