All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Command-level
@IgnoreOptionsnow also filters options contributed by the command's@Mixinfields, so a command can hide an option it inherits from a shared mixin without modifying the mixin - FemtoCli.parse and FemtoCli.parseAgent to parse arguments into command objects without invoking Runnable/Callable methods
- Builtin type converters for
short,byte, andcharfields ${COMPLETION-CANDIDATES}and${DEFAULT-VALUE}placeholder expansion in@Parametersdescriptions
- Increased minimal JAR size limit from 45KB to 50KB to accommodate bug fixes
- Missing builtin converters for
short/Short,byte/Byte, andchar/Characterfield types - Method-based
@Commandsubcommand help ignoringheader,description,footer, andcustomSynopsis SubcommandMethodWrappersilently returning exit code 0 for non-Integer method returns (now throws like class-based commands)parseDurationprecision loss for large integer duration values (now uses exact long arithmetic)- Empty
customSynopsisstring producing a bare "Usage: " line with no command info - Stale Javadoc on
invoke()claiming non-Integer returns are silently treated as 0
- Tiny regression from last patch update related to option tips
- Collection-typed options ignore the type information and always result in getting passed as String #3
- split fails when used in combination with defaultValue #2
- and many more
- Same reflection issue as before
- Issue with reflection and setAccessible on non-annotated fields
- Add mutually exclusive options using {@link Option#prevents()}
- FemtoCli.builder().removeCommands(Class<?>...) to remove commands dynamically at runtime
customSynopsisnow renders withUsage:prefix, consistent with auto-generated synopsis- Commands with both positional parameters and subcommands now correctly forward remaining args to subcommands (e.g.,
app <PID> start --verboseno longer reports--verboseas unknown on the parent command)
- Bare
helptoken is now recognized in subcommand position (e.g.,app helpis equivalent toapp --help)
- Synopsis line now renders positional parameters before
[COMMAND](e.g.,Usage: app PID [COMMAND]instead ofUsage: app [COMMAND] PID) - Converter exceptions now preserve the original error message instead of discarding it (e.g.,
Invalid value for <file>: File does not exist: foo.jfrinstead ofInvalid value for <file>: foo.jfr)
@Parameters(converter = ...)and@Parameters(converterMethod = ...)are now applied when binding positional arguments (previously they were silently ignored)
- Support for default commands
- Support for accessing parent command options in subcommands
- Suggest similar options when an unknown option is provided (e.g.,
tip: a similar argument exists: '--input-file') CommandConfig.suggestSimilarOptionsoption to enable/disable similar option suggestions (enabled by default)- Custom joiner syntax for
${COMPLETION-CANDIDATES:$JOINER}placeholder
- Release as JDK 17 JAR
runandrunCapturedmethods now accepts varargs ofStringinstead ofString[]for better usability
- Rename to femtocli, as there is already a CLI library named FemtoCli for PHP
- New unit tests:
BooleanOptionConverterTestandMixinConstructorAccessibilityTestto cover converter-backed boolean parsing and mixin constructor accessibility.
- Boolean options that declare a per-option converter (via
converterorconverterMethod) or that have a registered converter are now treated as value-taking options. This ensures values like--turn=onor--turn onare passed to the converter instead of being parsed as a flag. - Mixin initialization now makes the mixin constructor accessible before instantiation, avoiding
IllegalAccessExceptionfor package-private/non-public mixin constructors used in tests and user code. - Fix discovery of converter and verifier methods
- Agent argument support
- Add
@IgnoreOptionsto ignore options from parent commands or mixin in subcommands
- Boolean options now accept explicit values as separate tokens (e.g.
--flag false), in addition to--flagand--flag=false
- Added basic
FemtoCli#runmethod
- Subcommand handling in help
- Handling of private constructors and fields
Command#hiddento hide commands from help outpu in parent commandsOption#hiddento hide options from help output in commandsCommand#footerto add custom footers to help output in commands
- Support Java 17
- More flexible converters
- Verifier for options
- Spec mechanism to access usage and print streams at runtime in commands
- Hopefully fixed default value handling
- Support for
Durationparameters
- Initial implementation