You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

57 lines
1.3 KiB

#!/bin/bash -
readonly XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
readonly argv0=aur
readonly aur_version='AURUTILS_VERSION'
readonly lib_dir=${AUR_EXEC_PATH:-'AURUTILS_LIB_DIR'}
shopt -s nullglob
if [[ -z $1 ]]; then
printf >&2 'usage: %s [command]\n\n' "$argv0"
printf >&2 'available commands:\n'
for p in "$lib_dir"/aur-*; do
printf '%q\n' "${p##*/aur-}"
done | column >&2
printf >&2 '\navailable user commands:\n'
compgen -c aur- | sort -u | while IFS= read -r; do
if ! [[ -f $lib_dir/$REPLY ]]; then
printf '%q\n' "${REPLY#aur-}"
fi
done | column >&2
exit 1
fi
# load environment
if [[ -f ${AUR_ENV=$XDG_CONFIG_HOME/aurutils/env} ]]; then
while IFS=' = ' read -r key value; do
case $key in
AUR*) printf -v "$key" '%s' "$value"
export "${key?}" ;;
esac
done < <(pacini "$XDG_CONFIG_HOME/aurutils/env")
wait "$!"
fi
case $1 in
--version)
printf >&2 'aur version %s\n' "$aur_version"
exit 0 ;;
--env)
printenv | grep -E '^AUR' | sort >&2
exit 0 ;;
esac
if [[ "$PATH" != "$lib_dir:"* ]]; then
readonly PATH=$lib_dir:$PATH
fi
if type -P "aur-$1" >/dev/null; then
exec "aur-$1" "${@:2}"
else
printf >&2 '%s: %q is not an aur command\n' "$argv0" "$1"
exit 1
fi