Java command line parser with both an annotations API and a programmatic API, featuring usage help with ANSI colors, autocomplete and nested subcommands. In a single file, so you can include it in source form. This lets users run picocli-based applications without requiring picocli as an external dependency. Picocli-based applications can be ahead-of-time compiled to GraalVM native images, with extremely fast startup time and lower memory requirements, which can be distributed as a single executable file.
How it works: annotate your class and picocli initializes it from the command line arguments, converting the input to strongly typed data. Supports git-like subcommands (and nested sub-subcommands), any option prefix style, POSIX-style grouped short options, custom type converters, password options, negatable options, mutually exclusive options, mutually dependent options, repeatable nested option groups and more. Parser tracing facilitates troubleshooting. Command-line argument files (@-files) allow applications to handle very long command lines.
Distinguishes between named options and positional parameters and allows both to be strongly typed. Multi-valued fields can specify an exact number of parameters or a range (e.g., 0..*, 1..2). Supports Map options like -Dkey1=val1 -Dkey2=val2, where both key and value can be strongly typed.
Generates polished and easily tailored usage help and version help, using ANSI colors where possible. Works with Java 5 or higher (but is designed to facilitate the use of Java 8 lambdas).
Picocli-based command line applications can have TAB autocompletion, interactively showing users what options and subcommands are available. When an option has completionCandidates or has an enum type, autocompletion can also suggest option values. Picocli can generate completion scripts for bash and zsh, and offers picocli-shell-jline2 and picocli-shell-jline3 modules with JLine Completer implementations for building interactive shell applications.
Picocli-based applications can easily integrate with Dependency Injection containers. The `picocli-spring-boot-starter` module includes a PicocliSpringFactory and auto-configuration to use Spring dependency injection in your picocli command line application. Micronaut comes with picocli support built-in.
Picocli offers special support for Groovy scripts with the `picocli-groovy` module.
picocli alternatives and similar libraries
Based on the "Command-line Argument Parsers" category
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of picocli or a related project?