Used in production in all my products and some companies.
- Parse command-line arguments, environment variables, and configuration values all together.
- Self-documenting parsers for correct-by-construction documentation
- Best-in-class command-line autocompletion
- Best-in-class errors
- Formatter-friendly API
- Parsing
- Argument:
progname hello - Option:
progname --file foo.txt- Long Option:
progname --file foo.txt - Short Option:
progname -f foo.txt - Equals-version of long option:
progname --file=foo.txt - Shorthand-version of short option:
progname -ffoo.txt
- Long Option:
- Switch:
progname --verbose- Long switch:
progname --verbose - Short switch:
progname -v
- Long switch:
- Argument:
- Documentation
-
--help- Global
--helppage - Per-command
--helppage
- Global
- Generated
--versioncommand - Generated manpage
-
- Completion
- Bash completion
- Zsh completion
- Fish completion
- Static settings check
opt-env-conf |
optparse-applicative |
envparse |
autodocodec |
|
|---|---|---|---|---|
| Applicative parsing | ✔️ | ✔️ | ✔️ | ✔️ |
| Parsing arguments | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing long options | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing short options | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing short-hand short options | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing short-hand long options | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing long switches | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing short switches | ✔️ | ✔️ | ✖️ | ✖️ |
| Parsing environment variables | ✔️ | ✖️ | ✔️ | ✖️ |
| Parsing configuration values | ✔️ | ✖️ | ✖️ | ✔️ |
Generated global --help page |
✔️ | ✔️ | ✖️ | ✖️ |
Coloured global --help page |
✔️ | ✖️ | ✖️ | ✖️ |
Generated per-command --help page |
✔️ | ✔️ | ✖️ | ✖️ |
Coloured per-command --help page |
✔️ | ✖️ | ✖️ | ✖️ |
Generated --version command |
✔️ | ✖️ | ✖️ | ✖️ |
| Generated manpage | ✔️ | ✖️ | ✖️ | ✖️ |
| Helpful parse errors | ✔️ | ✔️ | ✔️ | ✔️ |
| Coloured parse errors | ✔️ | ✖️ | ✖️ | ✖️ |
| Generated manpage | ✔️ | ✖️ | ✖️ | ✖️ |
| Typo suggestions | 🚧 | ✖️ | ✖️ | ✖️ |
| Bash completion | ✔️ | ✔️ | ✖️ | ✖️ |
| Zsh completion | ✔️ | ✔️ | ✖️ | ✖️ |
| Fish completion | ✔️ | ✔️ | ✖️ | ✖️ |
| Static settings check | ✔️ | ✖️ | ✖️ | ✖️ |
The example application contains a fully worked example.
This example is part of the build in CI so you can rely on it being up-to-date.