ockam
ockam copied to clipboard
Explore if we can setup shell completion as part of install.sh
https://github.com/build-trust/ockam/blob/develop/install.sh
We love helping new contributors! ❤️ If you have questions or need help as you explore, please join us on Discord. If you're looking for other issues to contribute to, please checkout our good first issues.
More information on how to implement shell completion:
- https://github.com/build-trust/ockam/pull/5690
@mrinalwadhwa Hi! Please, could you clarify if the shell completion described in the following articles is the same referred to in this issue?
If so, could I be assigned? I'd love to try my hand at this.
PS: The link to install.sh
above is broken. Found it in the tools directory, though.
@mrinalwadhwa Hi! Please, could you clarify if the shell completion described in the following articles is the same referred to in this issue?
If so, could I be assigned? I'd love to try my hand at this.
PS: The link to
install.sh
above is broken. Found it in the tools directory, though.
@mrinalwadhwa Hi! Wanted to check if you've gotten a chance to check out my previous comment.
@Wryhder sorry for the slow response. I've ben traveling.. I'll share some thoughts later today
@Wryhder there's a detailed step on how to setup shell completion in this comment, Homebrew also has a writeup on how they setup bash completion https://docs.brew.sh/Shell-Completion. Here's how I will setup shell completion if it's only for zsh which I use In the install.sh script, I will
- create a new function called install_autocomplete_zsh
- Check if the ~/.zshrc file exist
- Create a file $HOME/.ockam/autocomplete/zsh/_ockam which will contain the autocomplete commands
- Add autocomplete path to zshrc
install_autocomplete_zsh() {
mkdir $HOME/.ockam/autocomplete
if [[ ! -f "~/.zshrc" ]]; then
echo "system doesn't support zsh shell"
return
fi
mkdir $HOME/.ockam/autocomplete/zsh
ockam autocomplete zsh > $HOME/.ockam/autocomplete/zsh/_ockam
info "Adding autocomplete to zsh"
echo >>"~/.zshrc"
echo "FPATH="$HOME/.ockam/autocomplete/zsh:${FPATH}" >> "~/.zshrc"
echo "autoload -Uz compinit" >> "~/.zshrc"
echo "compinit" >> "~/.zshrc"
}
I hope this helps
@Wryhder there's a detailed step on how to setup shell completion in this comment, Homebrew also has a writeup on how they setup bash completion https://docs.brew.sh/Shell-Completion. Here's how I will setup shell completion if it's only for zsh which I use In the install.sh script, I will
- create a new function called install_autocomplete_zsh
- Check if the ~/.zshrc file exist
- Create a file $HOME/.ockam/autocomplete/zsh/_ockam which will contain the autocomplete commands
- Add autocomplete path to zshrc
install_autocomplete_zsh() { mkdir $HOME/.ockam/autocomplete if [[ ! -f "~/.zshrc" ]]; then echo "system doesn't support zsh shell" return fi mkdir $HOME/.ockam/autocomplete/zsh ockam autocomplete zsh > $HOME/.ockam/autocomplete/zsh/_ockam info "Adding autocomplete to zsh" echo >>"~/.zshrc" echo "FPATH="$HOME/.ockam/autocomplete/zsh:${FPATH}" >> "~/.zshrc" echo "autoload -Uz compinit" >> "~/.zshrc" echo "compinit" >> "~/.zshrc" }
I hope this helps
@metaclips This helps a lot, thank you!