spk rev 22

Use colorize in some case and improve spk-ls --short
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 15 16:54:28 2012 +0200 (2012-05-15)
parents 320af418fedc
children 8fd53f8759ad
files spk spk-ls
line diff
     1.1 --- a/spk	Tue May 15 15:04:51 2012 +0200
     1.2 +++ b/spk	Tue May 15 16:54:28 2012 +0200
     1.3 @@ -65,11 +65,6 @@
     1.4  		cat $activity
     1.5  		separator && newline
     1.6  		exit 0 ;;
     1.7 -	ls|add)
     1.8 -		# Sort of helper on wrong commands or --option ? Or have better
     1.9 -		# usage/help: spk help [command] ?
    1.10 -		gettext "Did you mean ?"; echo " spk-$@"
    1.11 -		exit 0 ;;
    1.12  esac
    1.13  
    1.14  #
    1.15 @@ -121,7 +116,7 @@
    1.16  		. $installed/$pkg/receipt
    1.17  		boldify "$(gettext "Package") $pkg"
    1.18  		separator
    1.19 -		gettext "Status     : installed"; newline
    1.20 +		gettext "Status     :"; colorize " installed" 32
    1.21  		receipt_info
    1.22  		separator && newline
    1.23  		continue
    1.24 @@ -139,7 +134,7 @@
    1.25  		[ "$count" == 1 ] && newline
    1.26  		boldify "$(gettext "Package") $pkg"
    1.27  		separator
    1.28 -		gettext "Status     : not installed"; echo ""
    1.29 +		gettext "Status     :"; colorize " not installed" 31
    1.30  		echo "$mirrored" | awk 'BEGIN { FS = "|" } ; { print \
    1.31  			"Version    :" $2 "\n" \
    1.32  			"Short desc :" $3 "\n" \
     2.1 --- a/spk-ls	Tue May 15 15:04:51 2012 +0200
     2.2 +++ b/spk-ls	Tue May 15 16:54:28 2012 +0200
     2.3 @@ -25,13 +25,14 @@
     2.4    --count     $(gettext "Display the number of installed packages")
     2.5    --mirror    $(gettext "List all the packages on mirror")
     2.6    --blocked   $(gettext "List all blocked packages")
     2.7 -  --short     ls: $(gettext "Short list of installed packages")
     2.8 +  --short     $(gettext "Short list of installed packages")
     2.9    --root      $(gettext "Set the root file system path")
    2.10 +  --color=NB  $(gettext "Set package name color in list")
    2.11    --debug     $(gettext "Display some usefull debug information")
    2.12  
    2.13  $(boldify $(gettext "Examples:"))
    2.14    $name package1 package2 packageN
    2.15 -  $name --count
    2.16 +  $name --short --color=33
    2.17  
    2.18  EOT
    2.19  	exit 0
    2.20 @@ -53,13 +54,13 @@
    2.21  			IFS="|"
    2.22  			cat $pkgsdesc | while read package version desc category
    2.23  			do
    2.24 -				echo ""
    2.25 -				gettext "Package    :"; echo " $package"
    2.26 +				newline
    2.27 +				gettext "Package    :"; colorize " $package" 32
    2.28  				gettext "Version    :"; echo "$version"
    2.29  				gettext "Short desc :"; echo "$desc"
    2.30  			done && unset IFS
    2.31  			separator
    2.32 -			count_mirrored
    2.33 +			boldify $(count_mirrored)
    2.34  			echo "" && exit 0 ;;
    2.35  		--blocked)
    2.36  			if [ -f "$blocked" ]; then
    2.37 @@ -68,9 +69,17 @@
    2.38  				gettext "No blocked packages"; echo ""
    2.39  			fi && exit 0 ;;
    2.40  		--short)
    2.41 -			ls -1 $installed
    2.42 +			newline
    2.43 +			boldify "$(gettext "Installed packages")"
    2.44 +			separator
    2.45 +			for pkg in $(ls -1 $installed)
    2.46 +			do
    2.47 +				. $installed/$pkg/receipt
    2.48 +				echo -n "$(colorize "$pkg" 32)"; indent 28 " $VERSION"
    2.49 +			done
    2.50 +			separator
    2.51  			boldify $(count_installed)
    2.52 -			exit 0 ;;
    2.53 +			newline && exit 0 ;;
    2.54  		--*) continue ;;
    2.55  		*)
    2.56  			# List installed files by the package.
    2.57 @@ -106,9 +115,9 @@
    2.58  	. $pkg/receipt
    2.59  	count=$(($count + 1))
    2.60  	[ "$count" != 1 ] && newline
    2.61 -	gettext "Package    :"; echo " $PACKAGE"
    2.62 +	gettext "Package    :"; colorize " $PACKAGE" 32
    2.63  	receipt_info
    2.64  done
    2.65  separator
    2.66 -count_installed && newline
    2.67 +boldify $(count_installed) && newline
    2.68  exit 0