From 206237c8ec4b7619d9e70a75004cd1ae1066b0a0 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 25 Apr 1999 15:43:41 +0000 Subject: zsh-3.1.5-pws-16 --- Functions/Zftp/zftp_progress | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Functions/Zftp/zftp_progress (limited to 'Functions/Zftp/zftp_progress') diff --git a/Functions/Zftp/zftp_progress b/Functions/Zftp/zftp_progress new file mode 100644 index 000000000..e2b5084c4 --- /dev/null +++ b/Functions/Zftp/zftp_progress @@ -0,0 +1,18 @@ +# function zftp_progress { +# Basic progress metre, showing the percent of the file transferred. +# You want growing bars? You gotta write growing bars. + +# Don't show progress unless stderr is a terminal +[[ ! -t 2 ]] && return 0 + +if [[ $ZFTP_TRANSFER = *F ]]; then + print 1>&2 +elif [[ -n $ZFTP_TRANSFER ]]; then + if [[ -n $ZFTP_SIZE ]]; then + local frac="$(( ZFTP_COUNT * 100 / ZFTP_SIZE ))%" + print -n "\r$ZFTP_FILE ($ZFTP_SIZE bytes): $ZFTP_TRANSFER $frac" 1>&2 + else + print -n "\r$ZFTP_FILE: $ZFTP_TRANSFER $ZFTP_COUNT" 1>&2 + fi +fi +# } -- cgit 1.4.1