-
-
Notifications
You must be signed in to change notification settings - Fork 11
Add shell completion support for bash, zsh, and fish #71
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @hahwul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request introduces shell completion support for the deadfinder
tool, covering bash, zsh, and fish. It also updates the README to reflect the new completion
command. I've added a new file lib/deadfinder/completion.rb
which contains the completion scripts for each shell. The CLI has been updated to include a completion
command that outputs the appropriate script based on the shell specified. The gemspec file has been updated to include the new completion file. Finally, I've added tests for the new CLI command and the completion scripts.
Highlights
- Shell Completion: Implements shell completion for bash, zsh, and fish, making the tool easier to use from the command line.
- CLI Update: Adds a new
completion
command to the CLI for generating shell completion scripts. - README Update: The README has been updated to include the new
completion
command in the usage section. - New Completion Module: Introduces a new module
DeadFinder::Completion
to encapsulate the shell completion scripts. - Testing: Adds tests to verify the functionality of the new
completion
command and the generated scripts.
Changelog
Click here to see the changelog
- README.md
- Added
deadfinder completion <SHELL>
command to the usage section.
- Added
- deadfinder.gemspec
- Added
lib/deadfinder/completion.rb
to the list of files.
- Added
- lib/deadfinder/cli.rb
- Added
require 'deadfinder/completion'
. - Implemented the
completion
command to generate shell completion scripts for bash, zsh, and fish (lines 48-60).
- Added
- lib/deadfinder/completion.rb
- Created a new module
DeadFinder::Completion
with methods to generate bash, zsh, and fish completion scripts.
- Created a new module
- spec/dead_finder/cli_spec.rb
- Added tests for the
completion
command, verifying script generation for bash, zsh, and fish, and error handling for unsupported shells (lines 53-70).
- Added tests for the
- spec/dead_finder/completion_spec.rb
- Created a new spec file to test the
DeadFinder::Completion
module, verifying the content of the generated bash, zsh, and fish completion scripts.
- Created a new spec file to test the
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Did you know?
The 'shebang' line (#! /bin/bash) at the top of a bash script tells the operating system which interpreter to use to execute the script.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces shell completion support for bash, zsh, and fish, which is a useful addition to the deadfinder
tool. The implementation appears to be well-structured, with separate methods for generating completion scripts for each shell. The addition of tests for the completion functionality is also commendable.
Summary of Findings
- Error Handling for Unsupported Shells: The
completion
method inlib/deadfinder/cli.rb
handles unsupported shells by logging an error message. While this is good, consider raising an exception or providing a more informative message to the user. - Missing Shell Validation: The
completion
method inlib/deadfinder/cli.rb
doesn't validate the shell input. It might be beneficial to add a validation step to ensure that the input is one of the supported shells (bash, zsh, fish). - Zsh Completion Script: The zsh completion script in
lib/deadfinder/completion.rb
includes a commented-outcompdef deadfinder
line. This line is crucial for activating the completion. It should be uncommented or removed if it's not intended to be used.
Merge Readiness
The pull request is almost ready for merging. Addressing the comments regarding error handling, shell validation, and the zsh completion script would improve the quality of the code and make it more robust. I am unable to approve the pull request, and recommend that others review and approve this code before merging.
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
Implement shell completion functionality and update the README to include the new command for generating completion scripts.