[CLI-329] Support "Deprecated" CLI Options#252
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #252 +/- ##
============================================
+ Coverage 91.90% 92.33% +0.43%
- Complexity 575 612 +37
============================================
Files 22 23 +1
Lines 1247 1331 +84
Branches 210 218 +8
============================================
+ Hits 1146 1229 +83
+ Misses 63 60 -3
- Partials 38 42 +4 ☔ View full report in Codecov by Sentry. |
|
I will give this a stab... so the idea is to add two seperate options, the deprecated one as described above and the non deprecated one...? |
|
Hi @epugh |
|
So, one thing I didn't love is that now I get duplicated options when I run my Here is the commit where I tried this approach, maybe some other ways? apache/solr@ac699bc I wonder if we should change HelpFormatter to filter deprecated options? |
|
I also forgot to make the help formatter say an option is deprecated. Let me have a look... |
|
One more wrinkle in having the seperate options is that we need to remember to check both... We look up zkhost like this: and would need to check the |
- HelpFormatter does not print deprecated options by default - HelpFormatter can show deprecated options: HelpFormatter.builder().setShowDeprecated(true).get();
|
The lastest:
Reading your latest comment #252 (comment) |
I think that's fair, an application should decide what exact behavior it wants for deprecated options. Let me know what you think. |
That works! |
|
Okay, so I did: And I see deprecation message: |
|
I wonder if the deprecation message could be clearer and more concise. "[ Option 'zkHost' deprecated for removal since 9.6. Use --zk-host instead.]. where the Use --zk-host instead is the |
Deprecated string looks like: "Option 'c': Deprecated for removal since 2.0: Use X."
I updated the default deprecated string. You can customize the string by replacing the existing deprecated handler through The default handler is just |
|
Hi @epugh |
|
@garydgregory I am going to close my PR in favour of this one... What can I do to help move this along? |
|
@epugh |
https://issues.apache.org/jira/browse/CLI-329
Adds support to allow deprecation of Option objects.
A simple example:
A more detailed example: