commons-cli icon indicating copy to clipboard operation
commons-cli copied to clipboard

CLI-329: introduce to Options the tracking of deprecated short and long opts

Open epugh opened this issue 1 year ago • 2 comments

This allows you to migrate from a previous old short options to new ones.

In the Apache Solr project we would use it to support the migration of -zkHost to --zk-host for example by allowing the deprecated command line -zkHost to function, but logging an warning to the user with the preferred option name.

epugh avatar Mar 26 '24 13:03 epugh

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.28%. Comparing base (9f6b23b) to head (a6161da). Report is 51 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #251      +/-   ##
============================================
+ Coverage     91.90%   92.28%   +0.38%     
- Complexity      575      606      +31     
============================================
  Files            22       22              
  Lines          1247     1297      +50     
  Branches        210      215       +5     
============================================
+ Hits           1146     1197      +51     
+ Misses           63       60       -3     
- Partials         38       40       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Mar 26 '24 13:03 codecov-commenter

Hello @epugh Thank you for your PR. This is not the way to go IMO.

  • Deprecation should just be a boolean or an object that carries (a String description, a String since, and a boolean forRemoval, which is a combo of the stock annotation and Javadoc tag).
  • I don't think this library should always print to the console.
  • OptionBuilder is deprecated, we should not duplicate new features when added to Option.Builder

I propose https://github.com/apache/commons-cli/pull/252

garydgregory avatar Mar 26 '24 13:03 garydgregory

Closing in favour of #252

epugh avatar Mar 29 '24 15:03 epugh