Skip to content

Conversation

alirana01
Copy link
Collaborator

@alirana01 alirana01 commented Oct 2, 2025

Description

Added the Completions command to help generate the inline cli completions for shells.
Implements # (EIM-211)

Testing

For testing on macos we can run these commands to see the affect of it for the completion feature

mkdir -p ~/.zsh/completions
./eim --generate zsh > ~/.zsh/completions/_eim
chmod go-w ~ ~/.zsh ~/.zsh/completions
fpath+=(~/.zsh/completions)
autoload -Uz compinit; compinit
# map for current name; pick one:
compdef _eim eim        # if you run `eim`
# or:
compdef _eim ./eim=eim  # if you run `./eim`


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@alirana01 alirana01 self-assigned this Oct 2, 2025
@alirana01 alirana01 requested a review from Hahihula October 2, 2025 13:18
Copy link

Summary of Changes

Hello @alirana01, 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!

This pull request enhances the command-line interface by adding the capability to generate shell completion scripts. This feature significantly improves user experience by providing auto-completion for eim commands in various shell environments, making CLI interaction more efficient and less prone to typing errors.

Highlights

  • New CLI Command for Completions: Introduced a new Completions command to the CLI, allowing users to generate shell completion scripts for various shells directly from the command line.
  • Integration of clap_complete: The clap_complete crate has been integrated to provide robust and automatic generation of completion scripts, supporting shells like Zsh, Bash, Fish, PowerShell, and Elvish.
  • Dependency Updates: The Cargo.toml and Cargo.lock files have been updated to include the clap_complete dependency, ensuring the new functionality is available.
  • Code Reformatting: Several sections of Cargo.toml and src/cli/mod.rs have been reformatted for improved readability, including multiline definitions for assets, feature dependencies, and t! macro calls.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

Footnotes

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 a new completions command to generate shell completion scripts, leveraging the clap_complete crate. The implementation is straightforward and correct. My review includes a couple of suggestions to improve dependency management by making clap_complete an optional dependency tied to the cli feature, and a minor code cleanup to remove a redundant variable shadowing. Overall, this is a great addition to the CLI's usability.

Comment on lines 55 to 62
cli = [
"dep:clap",
"dep:dialoguer",
"dep:indicatif",
"dep:console",
"dep:log4rs",
"vendored-openssl",
]

Choose a reason for hiding this comment

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

medium

The clap_complete dependency is used for the Completions CLI command, so it should be part of the cli feature to ensure it's only included in CLI builds. This will prevent it from being included in builds that don't have the cli feature enabled.

To fix this, you should also mark clap_complete as optional in the [dependencies] section (line 153) like this:

clap_complete = { version = "4.5.58", optional = true }
Suggested change
cli = [
"dep:clap",
"dep:dialoguer",
"dep:indicatif",
"dep:console",
"dep:log4rs",
"vendored-openssl",
]
cli = [
"dep:clap",
"dep:clap_complete",
"dep:dialoguer",
"dep:indicatif",
"dep:console",
"dep:log4rs",
"vendored-openssl",
]

os_info = "3.12.0"


clap_complete = "4.5.58"
Copy link
Collaborator

@Hahihula Hahihula Oct 2, 2025

Choose a reason for hiding this comment

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

could you add this to the cli dependencies and make it optional and install only if cli feature is enabled?

@Hahihula
Copy link
Collaborator

Hahihula commented Oct 2, 2025

Also it would be nice if you update the documentation according to the cli change

Copy link
Collaborator

@Hahihula Hahihula left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. Just couple of nitpicks, as the clap_complete is for cli part, it should be optional dependency under the cli feature like the other cli dependencies (you can see that in cargo.toml)
Also if you are adding this functionality, you should also mention it in the documentation.
and last nitpick is that we do not use the 'feature/fix/something' prefix in the PR names, but on the other hands there should be the ticket designation present.
Also the man page should be updated with this.
Otherwise it LGTM!

@Hahihula Hahihula self-requested a review October 3, 2025 09:19
Copy link
Collaborator

@Hahihula Hahihula left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements. LGTM!
just please do not forget to squash the commits during the merge

@Hahihula Hahihula changed the title feature(completions): added the auto_clap functionality to generate completion scripts EIM-211: added the auto_clap functionality to generate completion scripts Oct 3, 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.

2 participants