-
Notifications
You must be signed in to change notification settings - Fork 34
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
Shell completion command #332
Shell completion command #332
Conversation
@cnpryer On a different project I also added a |
Another question, do you have any experience with the elvish shell? I don't actually know what the steps for adding the shell completion are for this. Besides these 2 questions, I think this pr is almost done. |
I'm not sure this is something I'd like to add. Couldn't the user just create an alias?
I do not. Thanks for the PR! I'll give this a review later today. |
As for the elvish part, I think I will also put a placeholder text in the suggestion. Maybe to a specific issue even. |
… it now prints the suggestion last
There probably also needs to be a more clear separation between the script and the suggestion on how to add the script to the users rc file. I was thinking something along the lines of
since it currently looks like this
What do you think? |
Do you mean adding it as a suggestion style behavior or documentation for it? I'd think documenting it somewhere would suffice, but I haven't thought much about it yet. |
This would be styling, imo it's not super clear where the script stops and the suggestion starts. Unless you redirect stdout to |
I'm a fan of less chatty CLI. Do you think we could get away with just adding usage docs to docs.rs in our lib.rs? I'll try giving this a spin later today to see if I'm missing something. |
Thats definitely possible, is the |
No. The readme is meant to be high level. I would like for everyone to read the readme, so adding too much there I think disincentivizes that. Good question though. |
Ah okay, I'll remove that section tomorrow then. |
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.
Hmm I think I understand better. I think I originally thought this command would setup the configuration, but it looks like we're just returning the configuration for the user to the add manually.
I'm not familiar with clap_complete
. Just thinking out loud maybe it'd be cool if we can just add the configuration using the command.
Also, this seems like more of an app-level command for huak
. So I'm wondering if we should nest commands like this under something like self
similar to how poetry
does it. I'm open to alternatives. Never been too much of a fan of self
specifically.
Otherwise thanks again for the PR. Looking great!
Co-authored-by: Chris Pryer <[email protected]>
Im not familiar with poetry actually. After reading the docs quickly the Since there are already a lot of commands in Do you want this subcommand to also be called Do you have other commands that could be moved under this "category"? Its probably a good idea to open a separate issue for all of those as well if that's the case since those seem out of scope for this issue. |
I personally don't like
I guess if I'd have to choose I'd choose No other commands implemented so far should be put under that subcommand afiak. I can double check in a bit. |
…etion script to init files
@cnpryer can you check the changes I made, I'm not sure if these tests suffice since they only test if the file gets created and cleaned up. Only the bash version checks for content. |
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.
Not sure if there was reasoning to throwing the Config
command enum in completion.rs, but I'd think this would be more appropriate in mod.rs. Wydt?
Made a few other comments.
If you'd like for me to wrap this PR lmk. I hate to be so picky. Appreciate the help! |
No I think the iteration is good, I'd rather have the pr take a little longer than it to be half baked. I'll be honest this feature did have some scope creep but all the feedback has been productive. |
Co-authored-by: Chris Pryer <[email protected]>
There are still the elvish and powershell implementations that need to be done. I'm not sure if these need to also be implemented in this pr since I have no way of testing these. |
No big deal if you want to leave those unimplemented. Maybe just add that to usage feedback. So if someone tries using that mention it's currently unimplemented and if they'd like the feature to submit an issue. |
IMO huak should not worry about shell completion (un)installation, that should be done by end user or distro packaging. It should just provide a way to output shell completion to Here are some distro packaging with shell completions examples: |
The implementation currently distinguishes between supported shells but it always outputs the same script. The initial implementation just simply printed the script to stdout iirc. Maybe its a good idea to have a clean |
Well I don't want to add any behavior that wouldn't be standard. I also don't want to make you rip this apart. So if you feel comfortable with the way this is currently implemented, let me know and I'll come in and finalize this later today. Are you looking for the hacktoberfest credit? |
No As far as ripping it apart goes, I think these things can exist side by side. Have |
Yea personally I don't have a problem with that. If the default behavior is to print to stdout then we're good. My comment here #332 (comment) is wrong. So I just wanted to make sure we're on the same page with this feedback. |
…ssed, otherwise huak config completion just prints to stdout
@cnpryer This is not a super important but currently if a user runs
|
Would this be difficult to remove? Less chatty the better imo and iirc from the convo shell isn't always required. Correct me if I'm wrong. |
Its only required if |
bed5b3c
to
b349eb4
Compare
b349eb4
to
c77fc9c
Compare
Thanks for the PR! |
Resolves #331
This pr aims to add a shell completion command so users can add a command to their shell start up script. It currently supports bash, elvish, fish, powershell and zsh.
This pr is initially opened as a draft, so there are still a number of tasks that need to be done.
- [ ] elvish documentationelvish not implemented issue
fishzsh documentation- [ ] add a rename flag so the binary can be renamed by the user- [ ] Implement elvish installation- [ ] Implement elvish uninstallation- [ ] Implement powershell installation- [ ] Implement powershell uninstallation