From 11a10666977ec26bc4b83b427f49404220ecd465 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 6 Aug 2008 14:18:20 +0200 Subject: [PATCH] zshrc: new function uopen --- debian/changelog | 4 +++- etc/skel/.zshrc | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 577d621..dc4eb17 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,9 +18,11 @@ grml-etc-core (0.3.51) unstable; urgency=low Thanks to Dennis Schreiber for pointing out. - Provide more processes in completion of programs like killall (thanks, ft). + - New function uopen to download a file and display it locally. + Thanks for the idea, formorer; thanks for debugging help, ft. :) * zshenv: set $PATH on Solaris/SunOS. - -- Frank Terbeck Wed, 06 Aug 2008 14:06:36 +0200 + -- Michael Prokop Wed, 06 Aug 2008 14:17:20 +0200 grml-etc-core (0.3.50) unstable; urgency=low diff --git a/etc/skel/.zshrc b/etc/skel/.zshrc index 62c82a8..5dbb267 100644 --- a/etc/skel/.zshrc +++ b/etc/skel/.zshrc @@ -3,7 +3,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest Change: Sat Jan 26 11:55:04 CET 2008 +# Latest change: Wed Aug 06 14:17:12 CEST 2008 [mika] ################################################################################ # source ~/.zshrc.global {{{ @@ -259,7 +259,7 @@ fi #f4# Search for newspostings from authors agoogle() { ${=BROWSER} "http://groups.google.com/groups?as_uauthors=$*" ; } #f4# Search Debian Bug Tracking System -debbug() { +debbug() { setopt localoptions extendedglob if [[ $# -eq 1 ]]; then case "$1" in @@ -360,6 +360,19 @@ ytdl() { fi } +# Function Usage: uopen $URL/$file +#f5# Download a file and display it locally +uopen() { + if ! [[ -n "$1" ]] ; then + print "Usage: uopen \$URL/\$file">&2 + return 1 + else + FILE=$1 + MIME=$(curl --head $FILE | grep Content-Type | cut -d ' ' -f 2 | cut -d\; -f 1) + MIME=${MIME%$'\r'} + curl $FILE | see ${MIME}:- + fi +} # Function Usage: doc packagename #f5# \kbd{cd} to /usr/share/doc/\textit{package} -- 2.1.4