diff options
| -rwxr-xr-x | bin/pkg | 20 | 
1 files changed, 14 insertions, 6 deletions
@@ -32,6 +32,14 @@ die () {  	exit 100  } +e_notinstalled () { +	die "Not installed: $1\n" +} + +e_invalid () { +	die "Not a valid package name: '$1'\n" +} +  clear_line () {  	echo -ne "\r                                                          \r"  } @@ -270,8 +278,8 @@ pkg_add () {  }  pkg_remove () { -	[ -d $PDIR/$1 ] || die "Package '$1' is not installed!\n" -	[ -d $PDIR/$1/.hg ] || die "Not a valid package: '$1'\n" +	[ -d $PDIR/$1 ] || e_notinstalled "$1" +	[ -d $PDIR/$1/.hg ] || e_invalid "$1"  	cd $PDIR/$1  	if ([ -r priority ]) {  		if ([ $(cat priority) -gt 3 ]) { @@ -289,7 +297,7 @@ pkg_remove () {  }  pkg_update () { -	cd $PDIR/$1 +	cd $PDIR/$1 || e_notinstalled "$1"  	info "Looking for updates: $1"  	NEW=$($VCS_CMD $VCS_OPTIONS $VCS_INCOMING)  	if ([ $? = 0 ]) { @@ -351,7 +359,7 @@ pkg_list_available () {  # Local modifications should not be overseen...  pkg_status () { -	cd $PDIR/$1 +	cd $PDIR/$1 || e_notinstalled "$1"  	info "looking for local modifications: $1"  #	check_deps $1  #	checklinks $CL_OPTIONS @@ -377,7 +385,7 @@ pkg_status_wrapper () {  # Various information related to a package  pkg_info () { -	cd $PDIR/$1 || return +	cd $PDIR/$1 || e_notinstalled "$1"  	[ -z "$1" ] && die "Not enough arguments\n"  	# Fetch the infos  	NAME="$1" @@ -423,7 +431,7 @@ pkg_info () {  }  pkg_log () { -	cd $PDIR/$1 || return +	cd $PDIR/$1 || e_notinstalled "$1"  	hg glog | less  }  | 
