Completions: add support for doas as for sudo#10256
Completions: add support for doas as for sudo#10256sholderbach merged 2 commits intonushell:mainfrom markfswe:patch-1
Conversation
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for giving this a shot!
No fault for not being familiar with Rust yet. In this case your changes not yet add support for command completion after sudo/doas. In the screenshot you can see that it only suggests files (which I think it will fallback to quite liberally)
|
@sholderbach thank you so much for review <3 Screenshots are just illustration of the problem, not it's solution :D I've made changes according to your code advice. |
Treat doas as sudo while command completing. Also adds "doas" to typos false positives.
|
@sholderbach Hi :) |
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for iterating on this!
I think we should in the future have a way to simply provide a list of commands or a signature that will take external commands and arguments in the trailing position.
But to get this resolved I am fine with landing this right now so we can unblock
|
Darn, I forgot about gsudo, that I sometimes use on windows. Now that I think about it, maybe it also has a sudo version of the command? |
Definitely. As Darren mentioned, it may be some other commands or just any command that wraps other binaries. I could not find a way to implement custom completion with current level of interfaces and/or documentation. Do you want me to open an issue for this? |
I think so. Thanks! |
|
@ZerdoX-x before this PR, I used to do it with |
|
note that |
I think anyways I'll open another issue since there are plenty of commands who accept another program as their first parameter. The most basic example here is |
|
|
# Description Fixes nushell#2047 but for the `doas` command the same way as in nushell#8094 # User-Facing Changes No breaking changes. If people not using `doas`, no difference at all. # Tests I have not added any tests since its using same logic as for "sudo". I guess if something would go wrong in this part, sudo tests will cover it? # Additional context As a nushell user I could not find a way to implement custom completion for a "sudo like command". Since I can see `sudo` being hardcoded in sources, this is what I propose. ~~Also I have almost zero knowledge of rust and this is definitely not the clean way yet~~ --------- Co-authored-by: Stefan Holderbach <[email protected]>
Description
Fixes #2047 but for the
doascommand the same way as in #8094Screenshots
Fixes this difference:User-Facing Changes
No breaking changes. If people not using
doas, no difference at all.Tests
I have not added any tests since its using same logic as for "sudo". I guess if something would go wrong in this part, sudo tests will cover it?
Additional context
As a nushell user I could not find a way to implement custom completion for a "sudo like command". Since I can see
sudobeing hardcoded in sources, this is what I propose.Also I have almost zero knowledge of rust and this is definitely not the clean way yet