Commits

Jack Frost committed 1f5bfbc

logic change

Comments (0)

Files changed (1)

 cfg_makepkg_flags='-rs'
 # /config
 
-zpm.msg() { echo "[zpm] $1"; }
+zpm.msg() { echo -en "[zpm] $1"; }
 zpm.err() { zpm.msg "(error) $1" >&2; }
 
 zpm.usage() {
 	local packages
 
 	zpm.args `zpm.getopt "$@"` || { return 1; }
-	packages="${args[@]}"
+	packages=( "${args[@]}" )
 
 	case "$action_group" in
 		sync)
 					for i in "${packages[@]}"; do
 						package_repo="`package-query --aur-url "$cfg_aur_url" -AS "$i" | head -1 | cut -d '/' -f1`"
 
-						[[ "$package_repo" ]] || {
-							zpm.err "Package $i not found.\n"
-							return 1
+						[[ "$package_repo" ]] && {
+							case "$package_repo" in
+								aur)
+									zpm.aur::get "$i" || return "$?"
+									[[ "$flag_download_only" ]] || {
+										zpm.build "$i" || return "$?"
+									}
+								;;
+	
+								*)
+									[[ "$flag_abs" ]] && {
+										zpm.abs::get "$i" || return "$?"
+										zpm.build "$i" || return "$?"
+									} || {
+										sudo pacman -S "$i" || return "$?"
+									}
+								;;
+							esac
+						} || {
+							[[ -e "$cfg_work_dir/$i" ]] && {
+								zpm.build "$i" || return "$?"
+							} || {
+								zpm.err "Package $i not found.\n"
+								return 1
+							}
 						}
-
-						case "$package_repo" in
-							aur)
-								zpm.aur::get "$i" || return "$?"
-								[[ "$flag_download_only" ]] || { zpm.build "$i"; }
-							;;
-
-							*)
-								[[ "$flag_abs" ]] && {
-									zpm.abs::get "$i" || return "$?"
-									zpm.build "$i"
-									return "$?"
-								} || {
-									sudo pacman -S "$i"
-								}
-							;;
-						esac
 					done
 				;;
 			esac