X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=30aaf5a34c0fc2b3bf269f191b22bc17bbcc6d0a;hb=4e55ae5f97813783479550922e4a5ca5a49ee7dc;hp=199b8975143d25b43c33b3f6fd924dc5800df25e;hpb=13c25df7bbde72e717b96e52e60c4cfd86cc8758;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 199b897..30aaf5a 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3680,51 +3680,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