Github messages for voidlinux
 help / color / mirror / Atom feed
From: crater2150 <crater2150@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] [RFC] [WIP] runit: respect SVDIR env variable in completion
Date: Tue, 16 Feb 2021 12:55:38 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-28790@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]

There is a new pull request by crater2150 against master on the void-packages repository

https://github.com/crater2150/void-packages sv_completion
https://github.com/void-linux/void-packages/pull/28790

[RFC] [WIP] runit: respect SVDIR env variable in completion
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. If there is interest in merging this, I'd check for a bash solution too.

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

[skip CI]
Does not change any compiled files

A patch file from https://github.com/void-linux/void-packages/pull/28790.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sv_completion-28790.patch --]
[-- Type: text/x-diff, Size: 934 bytes --]

From 2bb3c364edf056c12a07cc11d7f3cafe3bc4a114 Mon Sep 17 00:00:00 2001
From: Alexander Gehrke <github@qwertyuiop.de>
Date: Tue, 16 Feb 2021 12:44:58 +0100
Subject: [PATCH] runit: respect SVDIR env variable in completion

Allows sv's completion to complete other service directories, e.g. for
per-user services.
---
 srcpkgs/runit/files/_sv | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/runit/files/_sv b/srcpkgs/runit/files/_sv
index 465fbfde640..551beaa5ae8 100644
--- a/srcpkgs/runit/files/_sv
+++ b/srcpkgs/runit/files/_sv
@@ -35,7 +35,11 @@ cmds)
         check
     ret=0;;
 args)
-    services=( /var/service/*(-/N:t) )
+    if [[ $BUFFER == sudo* ]] then
+	    services=( /var/service/*(-/N:t) )
+    else
+	    services=( ${SVDIR:-/var/service}/*(-/N:t) )
+    fi
     (( $#services )) && _values services $services && ret=0
     [[ $words[CURRENT] = */* ]] && _directories && ret=0
     ;;

             reply	other threads:[~2021-02-16 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 11:55 crater2150 [this message]
2021-02-16 15:55 ` ericonr
2021-02-16 15:55 ` [PR PATCH] [Closed]: " ericonr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-28790@inbox.vuxu.org \
    --to=crater2150@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).