Skip to content

Add completions for ZSH and Bash #96

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

Merged
merged 3 commits into from
Apr 16, 2025
Merged

Conversation

bsdlme
Copy link
Contributor

@bsdlme bsdlme commented Mar 24, 2025

Tested on FreeBSD

@JohnAZoidberg
Copy link
Member

oh cool, that's a good idea!
Would you be able to help update the FreeBSD port after adding this?

Looks like we can even do it automatically because cmdline parsing is done by clap: https://github.com/clap-rs/clap/tree/master/clap_complete

@bsdlme
Copy link
Contributor Author

bsdlme commented Mar 25, 2025

Sure, I can help you with integrating the completions into the FreeBSD port.

@JohnAZoidberg
Copy link
Member

Tested on bash like this:

> bash
bash-5.2$ PATH=$PATH:target/debug
bash-5.2$ source completions/bash/framework_tool 
# Now I can tab complete flags and their values
bash-5.2$ framework_tool --driver portio

How do I test zsh? I can't figure it out

@bsdlme
Copy link
Contributor Author

bsdlme commented Mar 26, 2025

Tested on bash like this:

> bash
bash-5.2$ PATH=$PATH:target/debug
bash-5.2$ source completions/bash/framework_tool 
# Now I can tab complete flags and their values
bash-5.2$ framework_tool --driver portio

How do I test zsh? I can't figure it out

Save the completion file as /usr/local/share/zsh/site-functions/_framework_tool. Then create or edit ~/.zshrc with these lines:

autoload -Uz compinit
compinit

Run source ~/.zshrc then all completions from /usr/local/share/zsh/site-functions should work.

@JohnAZoidberg
Copy link
Member

Thanks, that works.

@JohnAZoidberg JohnAZoidberg merged commit 062815d into FrameworkComputer:main Apr 16, 2025
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.

None yet

2 participants