From a030fbf7262708ddbd62d40f59720bad46e6e7a3 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 15 Feb 2013 13:36:19 +0100 Subject: [PATCH] zshrc: add dcopyright function to display copyright file of a given package Similar to what dchange provides for changelogs, provide the same feature for copyright files (works at least on Debian systems). Thanks: Gregor Herrmann for the patch --- doc/grmlzshrc.t2t | 3 +++ etc/zsh/zshrc | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/doc/grmlzshrc.t2t b/doc/grmlzshrc.t2t index 8976684..69745c4 100644 --- a/doc/grmlzshrc.t2t +++ b/doc/grmlzshrc.t2t @@ -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. diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 50fac90..7b0f7a9 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -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 -- 2.1.4