diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-07-06 11:43:53 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-07-06 11:43:53 +0200 |
commit | 964b65061b349756aaca1b9d3e64ae7fc1fb1526 (patch) | |
tree | fca44554f62dbb18a71f02693e506b63681b3814 /bin/pkg | |
parent | 206705404178245fa5fc5020a8fed2e30441d8ac (diff) |
pkg: added COLOUR and PROGRESS settings and options
Diffstat (limited to 'bin/pkg')
-rwxr-xr-x | bin/pkg | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -54,6 +54,8 @@ if [[ -r $XDG_CONFIG_HOME/pkg/pkg.conf ]] { # Parse commandline options while [[ $1 == --* ]] { case $1 in + --coluors) COLOURS=1 ;; + --no-colours) COLOURS=0 ;; --quiet) SILENT=1 ;; --no-quiiet) SILENT=0 ;; --debug) DEBUG=1 ;; @@ -63,6 +65,8 @@ while [[ $1 == --* ]] { --checklinks-options) CL_OPTIONS+=$2; shift ;; --packagedir) PKG_DIR=$2; shift ;; --packageroot) PKG_ROOT=$2; shift ;; + --progress) PROGRESS=1 ;; + --no-progress) PROGRESS=0 ;; *) die "Unknown argument: '$1'\n" ;; esac shift @@ -78,6 +82,8 @@ shift : ${DEBUG=0} : ${AUTOUPDATE=1} : ${GIT_USE_ORIGIN=1} +: ${COLOURS=1} +: ${PROGRESS=1} export PKG_DIR export PKG_ROOT @@ -108,6 +114,13 @@ if (( SILENT )) { function info {} function say {} function clear_line {} + PROGRESS=0 +} + +if (( !COLOURS )) { + c_info='' + c_reset='' + c_error='' } if [[ ! -d $PKG_DIR ]] { @@ -195,7 +208,7 @@ function confirm_no { function wrap_info {} function progress { - (( SILENT )) && return + ((PROGRESS)) || return typeset -i current=$1 typeset -i max=$2 typeset desc=$3 |