Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
7d778ecd66 | |||
aa8929ff8e |
59
zpac
59
zpac
@@ -18,10 +18,10 @@ usage() {
|
|||||||
Flags:
|
Flags:
|
||||||
-h Show this message.
|
-h Show this message.
|
||||||
-s Search for <package>.
|
-s Search for <package>.
|
||||||
-S Search only in the sync db. Implies -s.
|
-S Search only in the sync db. Implies -s.
|
||||||
-A Search only in AUR. Implies -s.
|
-A Search only in AUR. Implies -s.
|
||||||
-d Get the package sources (default).
|
-d Get the package sources (default).
|
||||||
-D Get the dependencies also. Implies -d.
|
Set twice to also get the dependencies.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ aur.get() {
|
|||||||
aur_deps_count=$( jshon -e resultcount <<< "$aur_deps_api_data" )
|
aur_deps_count=$( jshon -e resultcount <<< "$aur_deps_api_data" )
|
||||||
|
|
||||||
if (( aur_deps_count )); then
|
if (( aur_deps_count )); then
|
||||||
aur_deps=$( jshon -e results -a -e Name -u <<< "$aur_deps_api_data" )
|
aur_deps=( $( jshon -e results -a -e Name -u <<< "$aur_deps_api_data" ) )
|
||||||
|
|
||||||
for i in "${aur_deps[@]}"; do
|
for i in "${aur_deps[@]}"; do
|
||||||
aur.get < <(aur.info "$i") || {
|
aur.get < <(aur.info "$i") || {
|
||||||
@@ -112,6 +112,44 @@ abs.get() {
|
|||||||
svn checkout "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
|
svn checkout "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args_norm() {
|
||||||
|
while (( $# )); do
|
||||||
|
unset -v arg opt c keys
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--) shift; break;;
|
||||||
|
|
||||||
|
--*)
|
||||||
|
IFS='=' read arg opt <<< "$1"
|
||||||
|
printf '%s\n' "$arg"
|
||||||
|
|
||||||
|
[[ "$opt" ]] && {
|
||||||
|
printf '%s\n' "$opt"
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
while read -n1 c
|
||||||
|
do
|
||||||
|
case "$c" in
|
||||||
|
-|'') :;;
|
||||||
|
*) keys+=( "-$c" );;
|
||||||
|
esac
|
||||||
|
done <<< "$1"
|
||||||
|
|
||||||
|
printf '%s\n' "${keys[@]}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[[ "$2" && ! "$2" =~ ^- ]] && {
|
||||||
|
printf '%s\n' "$2"
|
||||||
|
shift
|
||||||
|
}
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ -f "$HOME/.config/zpac.rc.sh" ]]; then
|
if [[ -f "$HOME/.config/zpac.rc.sh" ]]; then
|
||||||
source "$HOME/.config/zpac.rc.sh"
|
source "$HOME/.config/zpac.rc.sh"
|
||||||
@@ -129,10 +167,13 @@ main() {
|
|||||||
action='search'
|
action='search'
|
||||||
flag_search_syncdb=1;;
|
flag_search_syncdb=1;;
|
||||||
|
|
||||||
(-d) action='get';;
|
(-d)
|
||||||
(-D)
|
if [[ "$action" == 'get' ]]; then
|
||||||
action='get'
|
flag_get_deps=1
|
||||||
flag_get_deps=1;;
|
else
|
||||||
|
action='get'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
(--) shift; break;;
|
(--) shift; break;;
|
||||||
(-*)
|
(-*)
|
||||||
@@ -224,4 +265,4 @@ main() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main $(args_norm "$@")
|
||||||
|
Reference in New Issue
Block a user