Skip to content

Conversation

@ottlinger
Copy link
Contributor

@ottlinger ottlinger commented Nov 8, 2025

#508 contais the plain dependabot update, but the new version brings:

  • deprecations of HelpFormatter
  • has to replace build() by get()

TODO

@ottlinger ottlinger self-assigned this Nov 8, 2025
@ottlinger ottlinger changed the title RAT-442: Update to commons-cli and use new functionality of this release RAT-442: Update to commons-cli 1.10.0 and use new functionality of this release Nov 8, 2025
@Claudenw
Copy link
Contributor

Claudenw commented Nov 10, 2025

To fix this PR the following actions should be taken.

Change from org.apache.commons.cli.HelpFormatter to org.apache.commons.cli.help.HelpFormatter

And then understand that the new help formatter is intended to be built just before use.

The AbstractHelp class

  • get rid of AbstractHelp.RatHelpFormatter class.
  • should add a HelpFormatter.Builder protected final instance variable
  • the HelpFormatter.Builder should setShowSince to true
  • the HelpFormatter.Builder should setComparator to OptionCollection.OPTION_COMPARATOR
  • he HelpFormatter.Builder should setOptionFormatBuilder to a instance of OptionFormatBuilder that has setDeprecatedFormatFunction set to DEPRECATED_MSG.

In the rat.Help class printUsage method

  • A TextAppendable should be created that wraps the current writer.
  • The TextAppendable should have the max width set to the current HELP_WIDTH
  • set the HelpFormatter.Builder.setHelpAppendable to the TextAppendable;
  • call `HelpFormatter.Builder.get().printHelp(syntax, "", opts, "", true);

That will get us most of the way there for the basic help.

For the formatting of additional info use the TextHelpAppendable.printWrapped(), or create a table and use TextHelpAppendable.appendTable()

@ottlinger ottlinger changed the title RAT-442: Update to commons-cli 1.10.0 and use new functionality of this release RAT-442: Update to commons-cli 1.11.0 and use new functionality of this release Nov 15, 2025
@ottlinger
Copy link
Contributor Author

@Claudenw I also stumbled upon the rat.Licenses class, that showed me how much time I didn't spend in the sources ;)

@ottlinger ottlinger removed their assignment Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants