-
Notifications
You must be signed in to change notification settings - Fork 22
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
completions: add SVDIR support for zsh #15
base: master
Are you sure you want to change the base?
Conversation
completions/sv.zsh
Outdated
@@ -35,7 +35,11 @@ cmds) | |||
check | |||
ret=0;; | |||
args) | |||
services=( /var/service/*(-/N:t) ) | |||
if [[ $BUFFER == sudo* ]] 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.
I think it makes sense to also detect at least doas
, right?
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 didn't know about doas
, good point. I added it and also added su -c
.
completions/sv.zsh
Outdated
if [[ $BUFFER == sudo\ * | ||
|| $BUFFER == doas\ * | ||
|| $BUFFER == su\ *-c* ]] 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.
if [[ $BUFFER == sudo\ * | |
|| $BUFFER == doas\ * | |
|| $BUFFER == su\ *-c* ]] then | |
if [[ $BUFFER == "sudo "* | |
|| $BUFFER == "doas "* | |
|| $BUFFER == "su "*-c* ]] then |
does this work?
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.
Yes, those should be equivalent, just a style difference. Wasn't sure which one is preferred, as similar globs in the repo don't have spaces. I'll update it.
Allows sv's completion to complete other service directories, e.g. for per-user services. Currently only zsh, because it is easier than in bash to detect, if the command is prefixed with sudo/doas/su.
Moved from void-linux/void-packages#28790
Allows sv's completion to complete other service directories, e.g. for per-user services.
If the $SVDIR environment variable is set and sv isn't used with sudo, the completion is changed to complete services from $SVDIR. Otherwise behaviour is unchanged.
I currently have only implemented the change for zsh. In bash, the sudo completion modifies variables so that the completion of the following command doesn't "see" the sudo in the beginning. I'm still looking for ways to detect sudo in bash.