From 19d76f4e6f685c542e475a55f0b9187b151e35d0 Mon Sep 17 00:00:00 2001 From: Seppia Date: Sat, 2 Jun 2018 12:49:33 +0200 Subject: URL variables fix Used url variables in a more convenient way. --- repo.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'repo.sh') diff --git a/repo.sh b/repo.sh index dbddcce..36243a9 100755 --- a/repo.sh +++ b/repo.sh @@ -7,13 +7,13 @@ #REPO_NAME='repo_name' ## Search variables -URL_PREFIX='https://aur.archlinux.org/rpc/?v=5&type=search&by=name-desc&arg=' -CLONE_PREFIX='https://aur.archlinux.org/' +URL_PREFIX='https://aur.archlinux.org/' +SEARCH_STR='rpc/?v=5&type=search&by=name-desc&arg=' add_package() { if [ ! -d "${SRC_PATH}/$1" ]; then cd ${SRC_PATH} - git clone ${CLONE_PREFIX}$1.git + git clone ${URL_PREFIX}$1.git else echo 'WARNING: Package already present.' fi @@ -106,7 +106,7 @@ update_repo() { search_packages() { declare -a key=("${!1}") - CURL_JSN=$(curl -s $(echo ${URL_PREFIX}"${key[@]}" | sed -e 's/ /+/g')) + CURL_JSN=$(curl -s $(echo ${URL_PREFIX}${SEARCH_STR}"${key[@]}" | sed -e 's/ /+/g')) OUT_STR=$(jq -r '.results | .[] | [.Name, .Version], .Description' <<< ${CURL_JSN}) printf 'You searched using the following keywords (matching package name and/or description): "' printf '%s ' "${key[@]}" -- cgit v1.2.3