X-Git-Url: http://git.grml.org/?p=grml-etc-core.git;a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=88f736c9ba8a403056e8a1116e2268264d1e5fd9;hp=b87dab9fa8493034dfd642f3c0384f499940eb10;hb=3db9d153efb49547f4be787e0488b7f1d735f369;hpb=433f1c4bbbfb6c9b9aff0f26d42be4f2e6e07886 diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index b87dab9..88f736c 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3681,51 +3681,6 @@ fluxkey-change() { fi } -# retrieve weather information on the console -# Usage example: 'weather LOWG' -weather() { - emulate -L zsh - [[ -n "$1" ]] || { - print 'Usage: weather ' >&2 - print 'List of stations: http://en.wikipedia.org/wiki/List_of_airports_by_ICAO_code'>&2 - return 1 - } - - local VERBOSE="yes" # TODO: Make this a command line switch - - local ODIR=`pwd` - local PLACE="${1:u}" - local DIR="${HOME}/.weather" - local LOG="${DIR}/log" - - [[ -d ${DIR} ]] || { - print -n "Creating ${DIR}: " - mkdir ${DIR} - print 'done' - } - - print "Retrieving information for ${PLACE}:" - print - cd ${DIR} && wget -T 10 --no-verbose --output-file=$LOG --timestamping http://weather.noaa.gov/pub/data/observations/metar/decoded/$PLACE.TXT - - if [[ $? -eq 0 ]] ; then - if [[ -n "$VERBOSE" ]] ; then - cat ${PLACE}.TXT - else - DATE=$(grep 'UTC' ${PLACE}.TXT | sed 's#.* /##') - TEMPERATURE=$(awk '/Temperature/ { print $4" degree Celcius / " $2" degree Fahrenheit" }' ${PLACE}.TXT | tr -d '(') - echo "date: $DATE" - echo "temp: $TEMPERATURE" - fi - else - print "There was an error retrieving the weather information for $PLACE" >&2 - cat $LOG - cd $ODIR - return 1 - fi - cd $ODIR -} - # mercurial related stuff if check_com -c hg ; then # gnu like diff for mercurial