spk rev 88

spk-ls: warm if missing receipt
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 25 02:41:36 2012 +0200 (2012-05-25)
parents 75dbce631b42
children 91bb16e4eb16
files spk-ls
line diff
     1.1 --- a/spk-ls	Thu May 24 22:12:53 2012 +0200
     1.2 +++ b/spk-ls	Fri May 25 02:41:36 2012 +0200
     1.3 @@ -40,6 +40,18 @@
     1.4  	exit 0
     1.5  }
     1.6  
     1.7 +# Source a package receipt
     1.8 +source_receipt() {
     1.9 +	local receipt=$1
    1.10 +	if [ ! -f $receipt ]; then
    1.11 +		echo -n $(colorize 31 "$pkg")
    1.12 +		indent 28 $(gettext "missing receipt")
    1.13 +		continue
    1.14 +	else
    1.15 +		. $receipt
    1.16 +	fi
    1.17 +}
    1.18 +
    1.19  #
    1.20  # Handle --options
    1.21  #
    1.22 @@ -87,12 +99,13 @@
    1.23  			exit 0 ;;
    1.24  		--short)
    1.25  			newline
    1.26 -			boldify $(gettext "Installed packages")
    1.27 +			echo -n $(boldify $(gettext "Package"))
    1.28 +			indent 28 $(boldify $(gettext "Version"))
    1.29  			separator
    1.30  			for pkg in $(ls -1 $installed)
    1.31  			do
    1.32 -				. $installed/$pkg/receipt
    1.33 -				echo -n "$(colorize 32 $pkg)"; indent 28 " $VERSION"
    1.34 +				source_receipt $installed/$pkg/receipt
    1.35 +				echo -n "$(colorize 32 $pkg)"; indent 28 "$VERSION"
    1.36  			done
    1.37  			separator
    1.38  			boldify $(count_installed)