explicit and implicit action. Removed default one.
This commit is contained in:
parent
61a9cbd34d
commit
59432612de
39
zpac
39
zpac
|
@ -117,14 +117,23 @@ main() {
|
||||||
|
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--help|-h) usage; return 0;;
|
(-h) usage; return 0;;
|
||||||
|
|
||||||
-s) action='search';;
|
(-s) action='search';;
|
||||||
-d) action='get';;
|
(-A)
|
||||||
-D) flag_get_deps=1;;
|
action='search'
|
||||||
|
flag_search_aur=1;;
|
||||||
|
(-S)
|
||||||
|
action='search'
|
||||||
|
flag_search_syncdb=1;;
|
||||||
|
|
||||||
--) shift; break;;
|
(-d) action='get';;
|
||||||
-*)
|
(-D)
|
||||||
|
action='get'
|
||||||
|
flag_get_deps=1;;
|
||||||
|
|
||||||
|
(--) shift; break;;
|
||||||
|
(-*)
|
||||||
err "Unknown key: $1"
|
err "Unknown key: $1"
|
||||||
usage
|
usage
|
||||||
return 1
|
return 1
|
||||||
|
@ -135,7 +144,14 @@ main() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
action=${action:-"get"}
|
(( flag_search_aur && flag_search_syncdb )) && {
|
||||||
|
unset flag_search_aur flag_search_syncdb
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$action" ]] || {
|
||||||
|
usage
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ "$1" ]]; then
|
if [[ "$1" ]]; then
|
||||||
package="$1"
|
package="$1"
|
||||||
|
@ -186,8 +202,13 @@ main() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(search)
|
(search)
|
||||||
if type -P package-query &>/dev/null; then
|
if (( flag_search_aur )); then
|
||||||
package-query -ASs "$package"
|
aur.search "$package" || {
|
||||||
|
err "No packages found."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
elif (( flag_search_syncdb )); then
|
||||||
|
pacman -Ss "$package"
|
||||||
else
|
else
|
||||||
aur.search "$package" || { flag_aur_search_fail=1; }
|
aur.search "$package" || { flag_aur_search_fail=1; }
|
||||||
pacman -Ss "$package" 2>/dev/null || { flag_pacman_search_fail=1; }
|
pacman -Ss "$package" 2>/dev/null || { flag_pacman_search_fail=1; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user