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

CLI auto-complete support #1096

Closed
5 tasks
hu55a1n1 opened this issue Jun 16, 2021 · 8 comments · Fixed by #1789
Closed
5 tasks

CLI auto-complete support #1096

hu55a1n1 opened this issue Jun 16, 2021 · 8 comments · Fixed by #1789
Assignees
Labels
I: CLI Internal: related to the relayer's CLI O: new-feature Objective: cause to add a new feature or support
Milestone

Comments

@hu55a1n1
Copy link
Member

Crate

ibc-relayer-cli

Summary

Add auto-complete support using a rust crate (clap/gumdrop) that can automatically generate the completions file (see Clap::gen_completions()).

Acceptance Criteria

We should be able to achieve something like this ->
Clap auto-complete demo

The hermes documentation and README.md should provide instructions for setting this up. Also, installers/packages should be updated to include and source the completions file.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adizere adizere added this to the 08.2021 milestone Jun 24, 2021
@adizere adizere modified the milestones: 08.2021, 11.2021 Aug 3, 2021
@adizere adizere modified the milestones: 11.2021, 12.2021 Sep 6, 2021
@rnbguy
Copy link
Member

rnbguy commented Jan 12, 2022

I ended up here because of this. 😄
https://github.com/informalsystems/ibc-rs/blob/09a4b114b7fd414547c539bc8d541470c30b8164/scripts/gm/bin/shell-support#L110

I can take a look at this. This can be done in the same way rustup completions (bash|fish|zsh).

Here is how Archlinux distributes shell completions for Rustup.

    # Generate completion files.
    mkdir -p "$pkgdir/usr/share/bash-completion/completions"
    "$pkgdir"/usr/bin/rustup completions bash > "$pkgdir/usr/share/bash-completion/completions/rustup"
    "$pkgdir"/usr/bin/rustup completions bash cargo > "$pkgdir/usr/share/bash-completion/completions/cargo"
    mkdir -p "$pkgdir/usr/share/fish/vendor_completions.d"
    "$pkgdir"/usr/bin/rustup completions fish > "$pkgdir/usr/share/fish/vendor_completions.d/rustup.fish"
    mkdir -p "$pkgdir/usr/share/zsh/site-functions"
    "$pkgdir"/usr/bin/rustup completions zsh > "$pkgdir/usr/share/zsh/site-functions/_rustup"
    "$pkgdir"/usr/bin/rustup completions zsh cargo > "$pkgdir/usr/share/zsh/site-functions/_cargo"

@mzabaluev
Copy link
Contributor

This should be easy to do with clap 3.x.

@rnbguy
Copy link
Member

rnbguy commented Jan 12, 2022

clap_generate used to exist already, which is now deprecated in favor of clap_complete when clap 3.x reached stable.

My changes for Modelator are at informalsystems/modelator@0aa7d41.


I feel clap should provide a shell-completion feature to do this automatically.

@mzabaluev
Copy link
Contributor

I think we need to approach this by way of #1752, when we can start using clap 3.0 stable.

@mzabaluev mzabaluev added I: CLI Internal: related to the relayer's CLI O: new-feature Objective: cause to add a new feature or support labels Jan 13, 2022
@mzabaluev
Copy link
Contributor

My changes for Modelator are at informalsystems/modelator@0aa7d41.

@rnbguy Any chance to get the rnbguy/rust/clap-v3 branch for modelator merged soon? I've used it in #1777 draft, let's see if MBTs pass.

@mzabaluev
Copy link
Contributor

mzabaluev commented Jan 17, 2022

@rnbguy Any chance to get the rnbguy/rust/clap-v3 branch for modelator merged soon?

I was a bit out of date and I see how that informalsystems/modelator#163 has been merged. The question then turns into "when is the next release?"

@adizere adizere modified the milestones: v1.0.0, v0.10.1 Jan 17, 2022
@rnbguy
Copy link
Member

rnbguy commented Jan 17, 2022

I will do a patch release at the end of the day :)

@rnbguy
Copy link
Member

rnbguy commented Jan 17, 2022

modelator 0.4.2 is up 😃

@mzabaluev mzabaluev self-assigned this Jan 18, 2022
@mzabaluev mzabaluev mentioned this issue Jan 18, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: CLI Internal: related to the relayer's CLI O: new-feature Objective: cause to add a new feature or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants