-
Notifications
You must be signed in to change notification settings - Fork 8
Added auto-completion for shells #147
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
|
[Question] |
|
@24seconds running the app once will add autocompletion for the shell which was used. |
24seconds
left a comment
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.
Thank you for the work! I'm still reading some material related to clap_autocomplete and how autocompletion works for the review.
Here is the in the middle of review results. Please take a look 🙇
| reqwest = { version = "0.11", features = ["json"] } | ||
| colored = "2" | ||
| bincode = { version = "2.0.0-rc.1", features = ["alloc"]} | ||
| clap_complete = "3.2.2" |
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.
[Question]
Currently clap_complete's latest version is 4.1.4. (doc link) Is there a reason to use the version 3.2.2? Maybe rust-cli-pomodoro's clap version is 3.2.22 ?
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.
Correct, it's related to the clap's version. If I use the latest version I get some kind of error with generate which I don't understand. Something to do with the clap's main command generation
|
Thank you for handling the comment and leave comments. I didn't check the comment yet.. |
24seconds
left a comment
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.
I'm still understanding the auto completion.. 🙇 . I left some comments.
src/autocomplete.rs
Outdated
| } | ||
|
|
||
| /// Adds auto completion for the shell that is being used | ||
| pub fn add_autocomplete() -> Result<(), Box<dyn std::error::Error>> { |
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.
[Suggestion]
For the better error message, how about define custom error for auto completion?
rust-cli-pomodoro defines many custom errors in error.rs file.
Link:
rust-cli-pomodoro/src/error.rs
Line 1 in 0ab2e16
| use bincode::error::{DecodeError, EncodeError}; |
src/autocomplete.rs
Outdated
|
|
||
| /// Returns the current shell | ||
| fn get_current_shell() -> Result<Shell, Box<dyn std::error::Error>> { | ||
| if cfg!(target_os = "linux") { |
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.
[Question]
Is there a reason to target only linux? How about mac or window?
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.
I don't have a mac or windows. I don't know if the process would be the same over there.
How completion worksSo far I looked up the
SuggestionI found good example of In this PR, the code tries to do two things.
I think we should approach similar to rustup. Let To sum up, I suggest
What do you think? @TheRustyPickle |
|
Sounds good @24seconds. I liked the
where |
|
You are right. Thank you @TheRustyPickle ! |
|
Thank you @24seconds! I'm not very familiar with clap yet but will try to commit the new changes as soon as I am able. |
|
Hello @24seconds, correct me here if I am wrong here. If I don't enter the pomodoro cli interface by typing If we want to use I'm not sure if it was expected or whether this side is incomplete, I'm getting this error:
Alternatively, I was able to achieve this
or
Kindly advise on how to proceed here. I'm quite confused and not sure how things are working on the UDS side and if the error is exclusive to my device. Thank you for your time. |
|
I understand the situation. Ah.. Line 24 in 0ab2e16
Therefore, to determine which mode it is, we have a function named Line 162 in 0ab2e16
Currently there are two command type - StarUP and UdsClient. Now I guess it's time to add one more command type - completion ? autocomplete? something like this (please suggest command naming).
Suggestion
Then you can achieve what you wanted I guess. Please ask question @TheRustyPickle if something is unclear 🙇 |
|
Thank you for the kind explanation, @24seconds! It is much clearer for me and I have some ideas on what to work on now🙏 |
|
@24seconds when you have the time, please take a look at the new changes and let me know your thoughts. Thank you! You should be able to do this and it does not make use of the UDS client
|
24seconds
left a comment
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.
Looks good to me!! Super!
Thank you for the patient and long long communication. Because of you, I can understand this feature and rust-cli-pomodoro now has tab completion!
I will update version soon. Again, thank you!
|
[next step] |
|
Thank you so much for being so helpful and patient throughout the process, @24seconds! 🙏 |

#63 Added auto-completion support (Linux only) for Bash, Zsh, and Fish shells on Tab press. Gets initialized at the start of the program run