zsh-workers
 help / color / mirror / code / Atom feed
From: fREW Schmidt <frioux@gmail.com>
To: zsh-workers@zsh.org
Subject: [PATCH] new completion for "sv"
Date: Sun, 5 Oct 2014 15:01:35 -0500	[thread overview]
Message-ID: <20141005200135.GD58824@wanderlust.lan.mitsi.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 260 bytes --]

See attached a patch to add completion for sv
(http://smarden.org/runit/sv.8.html)

If anything is wrong just let me know, this would be my first
contribution to zsh so mistakes wouldn't surprise me.
-- 
fREW Schmidt
https://blog.afoolishmanifesto.com

[-- Attachment #1.2: 0001-new-completion-for-sv.patch --]
[-- Type: text/plain, Size: 3002 bytes --]

From a9b5d69371034e276548a8044c7dc8a021180ffb Mon Sep 17 00:00:00 2001
From: Arthur Axel 'fREW' Schmidt <frioux@gmail.com>
Date: Sun, 5 Oct 2014 14:52:42 -0500
Subject: [PATCH] new completion for "sv"

See http://smarden.org/runit/sv.8.html
---
 Completion/Unix/Command/_sv | 60 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Completion/Unix/Command/_sv

diff --git a/Completion/Unix/Command/_sv b/Completion/Unix/Command/_sv
new file mode 100644
index 0000000..9a55be1
--- /dev/null
+++ b/Completion/Unix/Command/_sv
@@ -0,0 +1,60 @@
+#compdef sv
+
+_arguments \
+  '-v[verbose]' \
+  '-w:wait time' \
+  ':command:->command' \
+  '*::options:->options'
+
+case $state in
+  (command)
+    local -a sv_ary
+    sv_ary=(
+           'status':'Get status of service (and log service if available)'
+               'up':'start if service is running. If service stops, restart'
+             'down':'send SIGTERM and SIGCONT if service is running. After it stops, do not restart'
+             'once':'start if service is not running. Do not restart if it stops'
+            'pause':'send SIGSTOP if service is running'
+             'cont':'send SIGCONT if service is running'
+              'hup':'send SIGHUP if service is running'
+            'alarm':'send SIGALRM if service is running'
+        'interrupt':'send SIGINT if service is running'
+             'quit':'send SIGQUIT if service is running'
+                '1':'send SIGUSR1 if service is running'
+                '2':'send SIGUSR2 if service is running'
+             'term':'send SIGTERM if service is running'
+             'kill':'send SIGKILL if service is running'
+             'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.'
+      )
+
+      local -a sv_lsb_ary
+      sv_lsb_ary=(
+                  'start':'up with check/timeout'
+                   'stop':'down with check/timeout'
+                 'reload':'hup with check'
+                'restart':'down and up with check'
+               'shutdown':'exit with check/timeout'
+             'force-stop':'stop with kill on timeout'
+           'force-reload':'reload with kill on timeout'
+          'force-restart':'restart with kill on timeout'
+         'force-shutdown':'shutdown with kill on timeout'
+            'try-restart':'restart if service is already running'
+      )
+
+      _describe -t commands "sv commands" sv_ary -V sv_commands
+      _describe -t commands "sv LSM init compat" sv_lsb_ary -V sv_init_compat
+      _describe -t commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm
+      return
+  ;;
+
+  (options)
+    local -a sv_services
+    sv_services=(
+      $SVDIR/*(N)
+      $SVDIR/*/log(N)
+    )
+
+    sv_services=( ${sv_services#$SVDIR/} )
+    _describe -t services "sv services" sv_services
+  ;;
+esac
-- 
1.9.3+fc2~572~g5a814b4


[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

             reply	other threads:[~2014-10-05 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-05 20:01 fREW Schmidt [this message]
2014-10-05 20:04 ` fREW Schmidt
2014-10-06  9:54   ` Christian Neukirchen
2014-10-06 19:37 ` Oliver Kiddle
2014-10-07 13:20   ` fREW Schmidt
2014-10-07 15:28     ` Oliver Kiddle
2014-10-07 16:03       ` fREW Schmidt

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=20141005200135.GD58824@wanderlust.lan.mitsi.com \
    --to=frioux@gmail.com \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).