Re: rc.d bash completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Le 18/05/2011 22:31, Tom Gundersen a écrit :
> 2011/5/18 Clément Démoulins <clement@xxxxxxxxxxx>:
>> Le 18/05/2011 18:24, Grigorios Bouzakis a écrit :
>>> Auguste Pop wrote:
>>>> i wrote a very simple rc.d bash completion script. is there any chance
>>>> it can be used upstream?
>>>
>>> I noticed earlier theres one for zsh in the AUR as well. I was about to
>>> suggest to the author to send it upstream but negelcted to.
>>> https://aur.archlinux.org/packages.php?ID=49136
>>>
>>> Greg
>>>
>> Hello,
>> I'm the author of the complection script for zsh and ok i can make a git
>> patch.
> 
> Thanks! I'll route all this through Seblu (just write to
> arch-projects@xxxxxxxxxxxxx) as he is the one working on rc.d (and he
> has some outstanding patches, so better let him coordinate it).
> 
> Cheers,
> 
> Tom

I tried to send the patch to arch-projects@xxxxxxxxxxxxx but i'm not
allowed to post in this mailing list.
I join the patch if you can send it.

Clément

-- 
Clef GPG : 0xDD51E028
From 90f7a583e4bc4219fcceec60cf5e610b40a633a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20D=C3=A9moulins?= <clement@xxxxxxxxxxx>
Date: Wed, 18 May 2011 22:16:02 +0200
Subject: [PATCH] Add a zsh completion script for the command rc.d.

---
 Makefile |    3 ++-
 _rc.d    |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletions(-)
 create mode 100644 _rc.d

diff --git a/Makefile b/Makefile
index 6923840..36668d3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 VER  := $(shell git describe)
-DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin
+DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin /usr/share/zsh/site-functions
 
 minilogd: minilogd.o
 
@@ -13,6 +13,7 @@ install: minilogd installdirs
 	install -m755 -t $(DESTDIR)/etc/cron.hourly adjtime
 	install -m755 -t $(DESTDIR)/etc/rc.d functions hwclock network netfs
 	install -m755 -t $(DESTDIR)/sbin minilogd rc.d
+	install -m644 -t $(DESTDIR)/usr/share/zsh/site-functions _rc.d
 
 clean:
 	rm -f minilogd minilogd.o
diff --git a/_rc.d b/_rc.d
new file mode 100644
index 0000000..b222bb6
--- /dev/null
+++ b/_rc.d
@@ -0,0 +1,36 @@
+#compdef rc.d
+
+_rc.d () {
+    local curcontext="$curcontext" state line
+    typeset -A opt_args
+
+    _arguments \
+        "1: :->action" \
+        "*: :->service"
+
+    case $state in
+        action)
+            _arguments "1:action:(list help start stop restart)"
+            ;;
+        service)
+            local action="$words[2]"
+            curcontext="${curcontext%:*:*}:rc.d-${action}:"
+
+            case $action in
+                list)
+                    _arguments "*: :"
+                    ;;
+                help)
+                    _arguments "*: :"
+                    ;;
+                *)
+                    _arguments "*: :_services"
+                    ;;
+            esac
+            ;;
+    esac
+}
+
+_rc.d "$@"
+
+# vim: filetype=zsh
-- 
1.7.5.1

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux