From be19b2565868a9d5c48bfa52ee6ba99a9ae494aa Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 20 Apr 2009 16:53:31 +0200 Subject: pkg: Moved all direct package list access into the list_ functions --- bin/pkg | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'bin/pkg') diff --git a/bin/pkg b/bin/pkg index 0f00ffb..4ec0499 100755 --- a/bin/pkg +++ b/bin/pkg @@ -298,6 +298,14 @@ function list_exists { grep "^$1 " $PDIR/.list-remote &> /dev/null } +function list_packages_local { + cut -d ' ' -f 1 $PDIR/.list +} + +function list_packages_remote { + cut -d ' ' -f 1 $PDIR/.list-remote +} + function list_incoming { [[ $(list_local_version $1) != $(list_remote_version $1) ]] } @@ -634,7 +642,7 @@ function wrap { info "$1: " } cd $PDIR - [[ -n $progress ]] && all=$(wc -l < $PDIR/.list) + [[ -n $progress ]] && all=$(list_packages_local | wc -l) [[ -n $progress ]] && current=0 for i in *(-/); { (( current++ )) @@ -712,15 +720,15 @@ function pkg_list { typeset package crap case $1 in ''|local) - cut -d ' ' -f 1 $PDIR/.list + list_packages_local ;; all|remote) - cut -d ' ' -f 1 $PDIR/.list-remote + list_packages_remote ;; not-installed) - while read package crap; do + for package in $(list_packages_remote); { list_is_installed $package || echo $package - done < $PDIR/.list-remote + } ;; esac } -- cgit v1.2.3