Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8591081269 | |||
9e15b8200e | |||
bf18623e06 |
11
README.md
11
README.md
@@ -2,16 +2,15 @@ zpac
|
||||
----
|
||||
A very simple AUR/ABS helper. Doesn't build packages, only gets the sources.
|
||||
|
||||
$ zpac -h
|
||||
Usage: zpac [flags] <package>
|
||||
Flags:
|
||||
Usage: zpac [flags] <package>
|
||||
Flags:
|
||||
-h Show this message.
|
||||
-s Search for <package>.
|
||||
-S Search only in the sync db. Implies -s.
|
||||
-A Search only in AUR. Implies -s.
|
||||
-d Get the package sources (default).
|
||||
-D Get the dependencies also. Implies -d.
|
||||
-d Get the package sources (default). Set twice to also get the dependencies.
|
||||
-f Force downloading package sources even if they are already present in the working directory.
|
||||
-w <dir> Set the working directory.
|
||||
|
||||
You can override any value in the script in \$HOME/.config/zpac.rc.sh
|
||||
By default zpac downloads the sources into the current directory. Controlled by `$cfg_workdir`.
|
||||
|
||||
|
67
zpac
67
zpac
@@ -23,10 +23,6 @@ usage() {
|
||||
-d Get the package sources (default). Set twice to also get the dependencies.
|
||||
-f Force downloading package sources even if they are already present in the working directory.
|
||||
-w <dir> Set the working directory.
|
||||
|
||||
Warning! Due to how the argument handling works, you can do this:
|
||||
$ zpac -wdd /tmp/workdir package
|
||||
Where /tmp/workdir is an argument to w. Don't do this. But it works, unfortunately.
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -142,6 +138,41 @@ abs.get() {
|
||||
svn checkout "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
|
||||
}
|
||||
|
||||
args_norm() {
|
||||
declare arg opt c
|
||||
declare -g argv
|
||||
|
||||
while (( $# )); do
|
||||
unset -v arg opt c
|
||||
|
||||
case "$1" in
|
||||
(--) argv+=( "$1" ); break;;
|
||||
|
||||
(--*)
|
||||
IFS='=' read arg opt <<< "$1"
|
||||
argv+=( "$arg" )
|
||||
|
||||
[[ "$opt" ]] && {
|
||||
argv+=( "$opt" )
|
||||
}
|
||||
;;
|
||||
|
||||
(-*)
|
||||
while read -n1 c
|
||||
do
|
||||
case "$c" in
|
||||
-|'') :;;
|
||||
*) argv+=( "-$c" );;
|
||||
esac
|
||||
done <<< "$1"
|
||||
;;
|
||||
|
||||
(*) argv+=( "$1" );;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ -f "$HOME/.config/zpac.rc.sh" ]]; then
|
||||
source "$HOME/.config/zpac.rc.sh"
|
||||
@@ -151,23 +182,17 @@ main() {
|
||||
case "$1" in
|
||||
(--) shift; break;;
|
||||
|
||||
(-*)
|
||||
while read -n1 c
|
||||
do
|
||||
case "$c" in
|
||||
(-|'') :;;
|
||||
(-h) usage; return 0;;
|
||||
|
||||
(h) usage; return 0;;
|
||||
|
||||
(s) action='search';;
|
||||
(A)
|
||||
(-s) action='search';;
|
||||
(-A)
|
||||
action='search'
|
||||
flag_search_aur=1;;
|
||||
(S)
|
||||
(-S)
|
||||
action='search'
|
||||
flag_search_syncdb=1;;
|
||||
|
||||
(d)
|
||||
(-d)
|
||||
if [[ "$action" == 'get' ]]; then
|
||||
flag_get_deps=1
|
||||
else
|
||||
@@ -175,20 +200,17 @@ main() {
|
||||
fi
|
||||
;;
|
||||
|
||||
(w)
|
||||
(-w)
|
||||
cfg_workdir="$2"
|
||||
shift;;
|
||||
|
||||
(f) flag_force=1;;
|
||||
(-f) flag_force=1;;
|
||||
|
||||
(*)
|
||||
(-*)
|
||||
err "Unknown key: $1"
|
||||
usage
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done <<< "$1"
|
||||
;;
|
||||
|
||||
(*) break;;
|
||||
esac
|
||||
@@ -273,4 +295,5 @@ main() {
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
args_norm "$@"
|
||||
main "${argv[@]}"
|
||||
|
Reference in New Issue
Block a user