From f0b31c94a2647b5161a46adb860b9b28112558ea Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 6 Jan 2009 19:49:43 +0100 Subject: pkg: Added wrap_info to prefix output if neccessary (e.g. in pkg refresh) [zsh fun fact: One cannot set aliases in functions] --- bin/pkg | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/pkg b/bin/pkg index 519bfe1..3751ddd 100755 --- a/bin/pkg +++ b/bin/pkg @@ -183,6 +183,8 @@ function confirm_no { ## Major internal functions ## +function wrap_info {} + function progress { (( SILENT )) && return current=$1 @@ -351,6 +353,7 @@ function global_hook { triggers+=$1 check_prereqs $1 if [[ -r Makefile ]] { + wrap_info $1 info "Running make\n" make } @@ -384,7 +387,8 @@ function check_prereqs { package=$1 [[ -r $PDIR/$package/prereqs ]] || return 0 cd $PDIR/$package - info "$package: checking prerequisites\n" + wrap_info $1 + info "checking prerequisites\n" typeset -a install typeset warn @@ -438,10 +442,7 @@ function populate_collected { cd $PDIR/$1 || return typeset -i bins=0 bino=0 mans=0 mano=0 - if (( wrapped )) { - clear_line - info "$1: " - } + wrap_info $1 info "Enabling documentation " if [[ -d man ]] { for i in man/*/*; { @@ -471,7 +472,7 @@ function populate_collected { } clear_line if (( bins + mans > 0 )) { - (( wrapped )) && info "$1: " + wrap_info $1 info "Compiled documentation " say -n '(' if (( bins + bino > 0 )) { @@ -502,6 +503,7 @@ function populate_collected { # TODO: Make sure there are none function genocide_collected { cd $PDIR/$1 || return + wrap_info $1 info "Removing documentation" if [[ -d man ]] { for i in man/*/*; { @@ -555,6 +557,10 @@ function wrap { $function $2 } else { wrapped=1 + function wrap_info { + clear_line + info "$1: " + } cd $PDIR [[ -n $progress ]] && all=$(wc -l < $PDIR/.list) [[ -n $progress ]] && current=0 @@ -653,7 +659,7 @@ function pkg_refresh { check_installed $1 cd $PDIR/$1 if [[ -r Makefile ]] { - clear_line + wrap_info info "Cleaning build diroctery\n" make clean } -- cgit v1.2.3