nandakumar131 opened a new pull request, #8030:
URL: https://github.com/apache/ozone/pull/8030
## What changes were proposed in this pull request?
Autocomplete for Ozone commands.
This is not a very good implementation.
- `GenericCli#getCmd` is used in `AutoCompletion`, which is only exposed for
tests (`@VisibleForTesting`)
- Since a new `Factory` class is used to load the `cmd` and
`subCmds` the command object created in `AutoCompletion` doesn't get access to
the sub commands unless `GenericCli#getCmd` is used.
- If we add any new top level command, we should manually add the command to
`AutoCompletion` class else generated auto-complete script will not work for
the new commands.
- Any change in top level options (the ones handled in ozone shell script)
should also be done in `AutoCompletion` class else the the suggestion will be
incorrect.
- Commands which are handled in shell script needs dummy classes to generate
auto-complete
- Commands that are inherited from Hadoop doesn't have auto-complete
The following commands are marked as hidden, so they won't have auto
complete.
- OzoneAdmin
- Insight
- CsiServer
- HddsDatanodeService
- OzoneManagerStarter
- Gateway
- StorageContainerManagerStarter
We don't have auto-complete support for the following commands
- dtutil (hadoop command)
- classpath. (handled in shell script, we can introduce a dummy class
here)
- envvars (handled in shell script, we can introduce a dummy
class here)
- fs (hadoop command)
- daemonlog (hadoop command)
We should be able to add an acceptance test where we compare the commands
available in the ozone CLI and the generated completion script. (I can't think
of any other way to test this)
As of now this is not exposed via Ozone CLI. If someone wants to test the
auto-complete feature, use the below command to generate the completion script.
```
java -classpath `bin/ozone classpath ozone-tools`:.
org.apache.hadoop.ozone.utils.AutoCompletion
```
You can also use the completion script from
[here](https://gist.github.com/nandakumar131/0f668a8fd580cde1f2cc7e5c9c949850).
Any feedback to change the design are welcome.
## What is the link to the Apache JIRA
HDDS-12519
## How was this patch tested?
Manual testing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]