Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash completion for spreaper #359

Closed
wants to merge 0 commits into from

Conversation

michaelsembwever
Copy link
Member

@michaelsembwever michaelsembwever commented Mar 5, 2018

No description provided.

@michaelsembwever
Copy link
Member Author

@joaquincasares are you any good at knowing how, and testing, that the bash completion script gets installed into the correct location during binary install.

@joaquincasares
Copy link
Contributor

@michaelsembwever what gets outputted here is pretty bad, but it works for basic use cases.

https://github.com/joaquincasares/python-bashcomplete

I remember it being slightly buggy in complicated use cases, but the outputted file should be enough to get you up and running. Once you try to customize it you'll quickly realize where the shortfalls are.

Sadly, all I know is what I programmed into this repo and that was after quite a bit of time trying to learn it all. The syntax is what killed me the most! :p

I just now realized you already had a commit and that looks far better than what my code generates! As far as testing, try: . ./path/to/completion-file.

Upon install, I believe this is the ideal place: /etc/bash_completion.

Source: https://www.howtoforge.com/how-to-add-bash-completion-in-debian

@michaelsembwever
Copy link
Member Author

@joaquincasares

I just now realized you already had a commit and that looks far better than what my code generates! …
Upon install, I believe this is the ideal place: /etc/bash_completion.
Source: https://www.howtoforge.com/how-to-add-bash-completion-in-debian

Yeah, I wrote that by hand, and it looks up autocompletion by making itself spreaper calls.
So the remaining piece is just ensuring that the script gets put into /etc/bash_completion.d/
And when that doesn't work, asking the user to put the line . /etc/bash_completion.d/spreaper into their bash profile.

@joaquincasares
Copy link
Contributor

Oh, good catch. Yup, /etc/bash_completion.d/ would be preferred. And that's a good note if they modified their profile for whatever reason.

Your code looks great though! As best as I can tell. :)

@michaelsembwever michaelsembwever force-pushed the mck/spreaper-initial-bash-completion branch from 5227394 to 6336510 Compare March 7, 2018 02:58
@michaelsembwever michaelsembwever changed the title WIP – Bash completion for spreaper Bash completion for spreaper Mar 7, 2018
@michaelsembwever
Copy link
Member Author

@internetstaff have any input on this PR?

@internetstaff
Copy link
Contributor

lgtm from an rhel packaging perspective, but I can't test it yet

Thanks for knocking this out - it was on my wishlist / todo!

Copy link
Contributor

@adejanovski adejanovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the package on Ubuntu after fixing the Makefile and completion works as expected there.

Great addition!

@@ -20,6 +20,7 @@ prepare:
cp resource/cassandra-reaper*.yaml build/etc/cassandra-reaper/configs
cp ../server/target/cassandra-reaper-$(VERSION).jar build/usr/share/cassandra-reaper/
cp bin/* build/usr/local/bin/
cp etc/bash_completion.d/spreaper build/etc/bash_completion.d/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add this line before running that command : mkdir -p build/etc/bash_completion.d

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. thanks. ps don't we have any tests for this?

@michaelsembwever michaelsembwever force-pushed the mck/spreaper-initial-bash-completion branch from 6336510 to 3b9e1d7 Compare March 14, 2018 01:31
michaelsembwever added a commit that referenced this pull request Mar 14, 2018
michaelsembwever added a commit that referenced this pull request Mar 14, 2018
@michaelsembwever michaelsembwever force-pushed the mck/spreaper-initial-bash-completion branch from 3b9e1d7 to 750a850 Compare March 14, 2018 23:25
@michaelsembwever michaelsembwever deleted the mck/spreaper-initial-bash-completion branch May 15, 2018 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants