diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-25 15:43:45 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-25 15:43:45 +0000 |
commit | e8eb43fc308acb3f1a8ebada7633c097e5050e46 (patch) | |
tree | 2df36ef3c7709c7d4d3b7bdcb5761f98649859bf /Functions/Zftp/zftp_progress | |
parent | e74702b467171dbdafb56dfe354794a212e020d9 (diff) | |
download | zsh-e8eb43fc308acb3f1a8ebada7633c097e5050e46.tar.gz zsh-e8eb43fc308acb3f1a8ebada7633c097e5050e46.tar.xz zsh-e8eb43fc308acb3f1a8ebada7633c097e5050e46.zip |
Initial revision
Diffstat (limited to 'Functions/Zftp/zftp_progress')
-rw-r--r-- | Functions/Zftp/zftp_progress | 18 |
1 files changed, 18 insertions, 0 deletions
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 +# } |