zshrc: add dcopyright function to display copyright file of a given package
authorMichael Prokop <mika@grml.org>
Fri, 15 Feb 2013 12:36:19 +0000 (13:36 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 15 Feb 2013 12:39:17 +0000 (13:39 +0100)
Similar to what dchange provides for changelogs, provide the
same feature for copyright files (works at least on Debian
systems).

Thanks: Gregor Herrmann <gregoa@debian.org> for the patch

doc/grmlzshrc.t2t
etc/zsh/zshrc

index 8976684..69745c4 100644 (file)
@@ -524,6 +524,9 @@ in it, including file names starting with ".".
 : **dchange()**
 Shows the changelog of given package in $PAGER.
 
+: **dcopyright()**
+Shows the copyright of given package in $PAGER.
+
 : **debian2hd()**
 Tells the user to use grml-debootstrap, if she wants to install debian to
 harddisk.
index 50fac90..7b0f7a9 100644 (file)
@@ -1913,6 +1913,19 @@ if check_com -c $PAGER ; then
     _dnews() { _files -W /usr/share/doc -/ }
     compdef _dnews dnews
 
+    #f1# View Debian's copyright of a given package
+    dcopyright() {
+        emulate -L zsh
+        if [[ -r /usr/share/doc/$1/copyright ]] ; then
+            $PAGER /usr/share/doc/$1/copyright
+        else
+            echo "No copyright file for package $1 found, sorry."
+            return 1
+        fi
+    }
+    _dcopyright() { _files -W /usr/share/doc -/ }
+    compdef _dcopyright dcopyright
+
     #f1# View upstream's changelog of a given package
     uchange() {
         emulate -L zsh