[
https://issues.apache.org/jira/browse/HDDS-11878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nandakumar updated HDDS-11878:
------------------------------
Fix Version/s: 2.0.0
Resolution: Fixed
Status: Resolved (was: Patch Available)
The PR is now merged! Thanks [~adoroszlai] for the contribution.
> Use CommandSpec to find top-level command
> -----------------------------------------
>
> Key: HDDS-11878
> URL: https://issues.apache.org/jira/browse/HDDS-11878
> Project: Apache Ozone
> Issue Type: Sub-task
> Components: Ozone CLI
> Reporter: Attila Doroszlai
> Assignee: Attila Doroszlai
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.0.0
>
>
> {{GenericParentCommand}} provides a way to access {{GenericCli}} methods from
> sub-subcommands. However, its usage is tedious and comes with boilerplate
> code that needs to:
> - implement {{GenericParentCommand}}
> - define methods manually
> - need member for {{@ParentCommand}} (injected by picocli)
> Adding new methods to {{GenericParentCommand}} becomes harder the more
> implementations we have.
> Example:
> {code}
> ... implements GenericParentCommand {
> @ParentCommand
> private Shell shell;
> @Override
> public boolean isVerbose() {
> return shell.isVerbose();
> }
> @Override
> public OzoneConfiguration createOzoneConfiguration() {
> return shell.createOzoneConfiguration();
> }
> {code}
> This needs to be implemented on all sub-command levels. Currently only very
> few implementations exists.
> Some subcommands access top-level command via similar parent chain, but
> without implementing {{GenericParentCommand}}.
> Picocli keeps track of the command hierarchy and allows accessing the
> top-level command directly via {{CommandSpec}}. Therefore we can remove
> parent chains (with or without {{GenericParentCommand}}).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]