Merge pull request #715 from AladW/build-repo-suffix
[aurutils.git] / aur.in
blobc5ec3e32a12ffb6421fe312e562f0abe8e78dc6d
1 #!/bin/bash -
2 readonly argv0=aur
3 readonly lib_dir=${AUR_EXEC_PATH:-'AURUTILS_LIB_DIR'}
4 shopt -s nullglob
6 if [[ -z $1 ]]; then
7 printf >&2 'usage: %s [command]\n\n' "$argv0"
8 printf >&2 'available commands:\n'
10 for p in "$lib_dir"/aur-*; do
11 printf '%q\n' "${p##*/aur-}"
12 done | column >&2
14 printf >&2 '\navailable user commands:\n'
16 compgen -c aur- | sort -u | while IFS= read -r; do
17 if ! [[ -f $lib_dir/$REPLY ]]; then
18 printf '%q\n' "${REPLY#aur-}"
20 done | column >&2
22 exit 1
25 if [[ "$PATH" != "$lib_dir:"* ]]; then
26 readonly PATH=$lib_dir:$PATH
29 if type -P "aur-$1" >/dev/null; then
30 exec "aur-$1" "${@:2}"
31 else
32 printf >&2 '%s: %q is not an aur command\n' "$argv0" "$1"
33 exit 1