[
https://issues.apache.org/jira/browse/CASSANDRA-20794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112580#comment-18112580
]
Stefan Miklosovic edited comment on CASSANDRA-20794 at 9/8/26 8:28 AM:
-----------------------------------------------------------------------
[~rishabhsaraswat]
This is a great addition but we need to be a bit more pedantic about this. We
most probably need to add this to a release tarball and maybe RPM / DEB package
too. Then upon installation of these packages we need to add them to respective
system directories for shell completion. For example, this is directly in
generated autocompletion script:
{code}
# 1a. Alternatively, if you have
[bash-completion](https://github.com/scop/bash-completion) installed:
# Place this file in a `bash-completion.d` folder:
#
# * /etc/bash-completion.d
# * /usr/local/etc/bash-completion.d
# * ~/bash-completion.d
{code}
https://github.com/scop/bash-completion is GPL-2.0.
There is also manual way to do this:
{code}
# 1. Source all completion scripts in your .bash_profile
#
# cd $YOUR_APP_HOME/bin
# for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep
"$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
#
{code}
Not sure what we choose to go with, if we leave this on a user completely, but
for RPM / DEB I still think it makes sense to put it to
/usr/local/etc/bash-completion.d at least. I see that {{bash-completion}} is a
package one can install in Debian at least (1) so we might depend on this
package when installing DEB / RPM too.
so I can imagine that this would go to {{/usr/local/etc/bash-completion.d}}
upon the installation of these packages.
We also need to figure out where to put this file in the source tarball, figure
out what licence that file should have or we set it among ignored in {{ant
rat}}.
I do not think it is a good idea to generate this into {{build}} directory.
This file might be committed into the repository. That way when we add a new
command or change it, mere build will regenerate this script so it will be
always aligned.
cc [~brandon.williams] [~mck]
(1) https://packages.debian.org/search?keywords=bash-completion
was (Author: smiklosovic):
[~rishabhsaraswat]
This is a great addition but we need to be a bit more pedantic about this. We
most probably need to add this to a release tarball and maybe RPM / DEB package
too. Then upon installation of these packages we need to add them to respective
system directories for shell completion. For example, this is directly in
generated autocompletion script:
{code}
# 1a. Alternatively, if you have
[bash-completion](https://github.com/scop/bash-completion) installed:
# Place this file in a `bash-completion.d` folder:
#
# * /etc/bash-completion.d
# * /usr/local/etc/bash-completion.d
# * ~/bash-completion.d
{code}
so I can imagine that this would go to {{/usr/local/etc/bash-completion.d}}
upon the installation of these packages.
We also need to figure out where to put this file in the source tarball, figure
out what licence that file should have or we set it among ignored in {{ant
rat}}.
I do not think it is a good idea to generate this into {{build}} directory.
This file might be committed into the repository. That way when we add a new
command or change it, mere build will regenerate this script so it will be
always aligned.
cc [~brandon.williams] [~mck]
> Generate autocompletion scripts for the nodetool command during the build
> -------------------------------------------------------------------------
>
> Key: CASSANDRA-20794
> URL: https://issues.apache.org/jira/browse/CASSANDRA-20794
> Project: Apache Cassandra
> Issue Type: Improvement
> Components: Build
> Reporter: Maxim Muzafarov
> Assignee: Rishabh Saraswat
> Priority: Normal
> Fix For: 7.x
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> All picocli-based applications can have command line completion in Bash or
> ZSH Unix shells. Picocli can generate an autocompletion script tailored to
> your application.
> It may be useful to generate your completion scripts automatically during the
> build.
> See the details below:
> https://picocli.info/autocomplete.html#_generating_completion_scripts_during_the_build
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]