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

feat(cli): add completions command to jstz #382

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

johnyob
Copy link
Collaborator

@johnyob johnyob commented Feb 8, 2024

Context

Related Tasks: Shell autocompletions for CLI

Description

This PR adds a completions command to jstz, which prints the autocompletions for the CLI to stdout

Manually testing the PR

Since we don't yet globally install jstz as a binary, it's a bit finicky to test locally.

For zsh:

autoload -U compinit && compinit
source <(cargo run --bin jstz -- completions --shell=zsh)
compdef _jstz ./target/debug/jstz

To use the completions, you must use ./target/debug/jstz [Tab] ([Tab] denotes you pressing tab). I've not been able to get this to work with cargo run --bin jstz -- ...

For other shells:
clap-rs/clap#2488 (comment)

Copy link
Contributor

@sam-finch-tezos sam-finch-tezos left a comment

Choose a reason for hiding this comment

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

🎉 🥳 Awesome!
Happy to merge on the grounds that merged is better than not merged.
I had to install a couple of things to get it to work

brew install --cask autodmg
brew install compiledb

Could I suggest the following additions (if possible) before you close the ticket

  • Add whatever is necessary to our nix to work in the nix-shell
  • Add something to the makefile so that target/debug/jstz and target/release/jstz are set up for you.

If that's not possible or a pain to do then don't worry

@johnyob
Copy link
Collaborator Author

johnyob commented Feb 9, 2024

Add whatever is necessary to our nix to work in the nix-shell

If you're using direnv (as you ought to be), then the shell is configured externally to nix

Add something to the makefile so that target/debug/jstz and target/release/jstz are set up for you.

This is possible, I can probably set it up for zsh. But perhaps in a different PR?

Copy link
Collaborator

@ryutamago ryutamago left a comment

Choose a reason for hiding this comment

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

LGTM!

@sam-finch-tezos
Copy link
Contributor

Add something to the makefile so that target/debug/jstz and target/release/jstz are set up for you.

This is possible, I can probably set it up for zsh. But perhaps in a different PR?
Absolutely, just add a note to the ticket and but it back into planned.

@johnyob
Copy link
Collaborator Author

johnyob commented Feb 13, 2024

Absolutely, just add a note to the ticket and but it back into planned.

https://app.asana.com/0/1205770721173531/1206520076651987/f

@johnyob johnyob force-pushed the ajob410@cli/shell-autocomplete branch from d206ac7 to 50ab39c Compare February 13, 2024 11:11
@johnyob johnyob merged commit 497ef97 into main Feb 13, 2024
6 checks passed
@johnyob johnyob deleted the ajob410@cli/shell-autocomplete branch February 13, 2024 11:21
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.

4 participants