accumulo icon indicating copy to clipboard operation
accumulo copied to clipboard

Wish list: bash completions for bin/accumulo

Open ctubbsii opened this issue 1 year ago • 2 comments

This is kind of far out there, and I'm not sure it should go in the main Accumulo project, but we have a lot of utilities that can be run off of the bin/accumulo command, including all the bin/accumulo admin commands. My preferred shell is bash, and bash supports an extensible mechanism to add autocompletion to commands. It would be neat to be able to provide a completer script to be used with bash, to make it easier to use the bin/accumulo command.

Some references:

  • https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html
  • https://superuser.com/a/289559
  • https://opensource.com/article/18/3/creating-bash-completion-script

If we shipped this, I'd imagine it'd be shipped as part of some "extras" package, rather than part of Accumulo's core build.

ctubbsii avatar Aug 14 '24 19:08 ctubbsii

I'm interested in working on this issue

ibilley7 avatar Jun 05 '25 18:06 ibilley7

There are two different approaches I am considering for this ticket:

  1. Hard-code all options and commands. Would require updates whenever the accumulo commands are changed, added, or removed, but has a relatively simple implementation.
  2. Create a list-commands option through the Main.java file that would called before any auto-completions are done, which will list all commands and their various sub commands and options. These commands would be extracted and stored in order to construct the calls to compgen and complete functions. This approach is more difficult and could possibly be more resource intensive than the first approach, but would take less to maintain across future versions, and would likely be compatible across different versions.

Any feedback on the approaches and about which direction I should go in would be much appreciated.

I also have a question: is there any documentation or release notes that document changes to the commandline options between different versions of Accumulo? If I proceed with the hard-coding approach, it would useful to know if bash completion could work for older version of Accumulo.

ibilley7 avatar Jun 12 '25 17:06 ibilley7