Last active
July 18, 2022 23:34
-
-
Save ConnerWill/24f08408aac296a3d7df6be383915103 to your computer and use it in GitHub Desktop.
Search for packages and return formatted names and descriptions: to be used to feed into fzf :):(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##############################################################################: | |
##############################################################################: | |
##: | |
##: | |
####: DEFINE_CHAR_VARIABLES | |
##: {{{ DEFINE_CHAR_VARIABLES | |
_thin_line_sep="---------------------------------------------------" | |
_thicc_line_sep="===================================================" | |
##: DEFINE_CHAR_VARIABLES }}} | |
####: | |
##: | |
##: | |
####: DECLARE_PACKAGE_ARRAY | |
##: {{{ DECLARE_PACKAGE_ARRAY | |
declare -a packageArray | |
packageArray=( | |
"fzf" | |
"zsh" | |
"neovim" | |
"tmux" | |
"git" | |
) | |
##: DECLARE_PACKAGE_ARRAY }}} | |
####: | |
##: | |
##: | |
####: SAVE_TERMINIAL | |
##: {{{ SAVE_TERMINIAL | |
tput smcup ; clear | |
##: SAVE_TERMINIAL}}} | |
####: | |
##: | |
##: | |
####: MAIN_LOOP | |
##: {{{ MAIN_LOOP | |
#awk -F'/' '{printf "%-52s%-15s%-20s%-28s%-15s%-15s%-15s\n", "$1" "$2" "$3" "$4" "$5" "$6" "$7" | |
printf "%s\n" "${_thicc_line_sep}" | |
for searchpackage in "${packageArray[@]}" | |
do | |
printf "Searching for %s\n" "${searchpackage}" | |
printf "%s\n" "${_thin_line_sep}" | |
#sed 's/\r/\s/g' <(yay -Si --singlelineresults "${searchpackage}" | egrep --regex '(Name)|(Description)|(Version)|(Conflicts With)|(Depends On)' | cut -d':' -f2- ) | |
sed 's/\r\n//g' <(yay -Si --singlelineresults "${searchpackage}" | grep --extended-regex --regex '(Name)|(Description)' | cut -d':' -f2- ) | |
printf "%s\n" "${_thin_line_sep}" | |
read -s -r | |
sleep 3 | |
clear | |
done | |
printf "%s\n" "${_thicc_line_sep}" | |
##: MAIN_LOOP }}} | |
####: | |
##: | |
##: | |
####: RESTORE_TERMINIAL | |
##: {{{ RESTORE_TERMINIAL | |
tput rmcup | |
##: RESTORE_TERMINIAL }}} | |
####: | |
##: | |
##: | |
####: CLEANUP_TASKS | |
##: {{{ CLEANUP_TASKS | |
printf "\n\nGOODBYE\n\n" | |
#sed 's/) */)\t/g' | | |
# awk -F'\t' '{printf "%-52s%-15s%-20s%-28s%-15s%-15s%-15s\n", | |
# $1,$2,$3,$4,$5,$6,$7}' | |
##: CLEANUP_TASKS }}} | |
####: | |
##: | |
##: | |
###############################################################################: | |
###############################################################################: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment