diff options
author | Yash Karandikar | 2020-03-14 15:57:16 -0500 |
---|---|---|
committer | Yash Karandikar | 2020-03-15 19:27:14 -0500 |
commit | 57ffb379de6c019ed9ecb45fafecc542a2508561 (patch) | |
tree | 1c93fcfd72f4e246f3d31bce854c918b5f3c3081 | |
parent | f44a2151184c20049fbb04ef6aded848c975a2d9 (diff) | |
download | aur-57ffb379de6c019ed9ecb45fafecc542a2508561.tar.gz |
Output with colors when searching
-rwxr-xr-x | haur | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -5,16 +5,6 @@ die () { exit 1 } -search () { - search_term=$1 - mapfile -t name < <(curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$search_term" | jq -r ".results" | jq -r ".[] | .Name") - mapfile -t version < <(curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$search_term" | jq -r ".results" | jq -r ".[] | .Version") - mapfile -t description < <(curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$search_term" | jq -r ".results" | jq -r ".[] | .Description") - for (( i=0; i<${#name[@]}; i++ )); do - echo "${name[i]} ${version[i]}: ${description[i]}" - done -} - if [ -f "$HOME"/.config/haurrc ]; then # shellcheck source=/dev/null source "$HOME"/.config/haurrc @@ -34,13 +24,13 @@ if [ ! "$HAUR_NO_COLORS" == "y" ]; then ncolors=$(tput colors 2>/dev/null) if test -n "$ncolors" && test "$ncolors" -ge 8; then - # bold="$(tput bold 2>/dev/null)" + bold="$(tput bold 2>/dev/null)" # underline="$(tput smul 2>/dev/null)" # standout="$(tput smso 2>/dev/null)" normal="$(tput sgr0 2>/dev/null)" # black="$(tput setaf 0 2>/dev/null)" red="$(tput setaf 1 2>/dev/null)" - # green="$(tput setaf 2 2>/dev/null)" + green="$(tput setaf 2 2>/dev/null)" # yellow="$(tput setaf 3 2>/dev/null)" blue="$(tput setaf 4 2>/dev/null)" # magenta="$(tput setaf 5 2>/dev/null)" @@ -50,6 +40,16 @@ if [ ! "$HAUR_NO_COLORS" == "y" ]; then fi fi +search () { + search_term=$1 + mapfile -t name < <(curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$search_term" | jq -r ".results" | jq -r ".[] | .Name") + mapfile -t version < <(curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$search_term" | jq -r ".results" | jq -r ".[] | .Version") + mapfile -t description < <(curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$search_term" | jq -r ".results" | jq -r ".[] | .Description") + for (( i=0; i<${#name[@]}; i++ )); do + echo "${bold}${blue}${name[i]} ${green}${version[i]}${normal}: ${description[i]}" + done +} + REMOVE=false CLEAR_CACHE=false UPDATE=false |