Created
January 14, 2024 08:29
-
-
Save yunginnanet/d4a12623cf193e9d1dc54070d7b0878a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# snag: colorize, bat, apt-file, apt-fast, toilet | |
alias aget='sudo apt-get install' | |
alias qaget='sudo apt-fast -y install' | |
alias aremove='sudo apt-get remove' | |
alias apurge='sudo apt-get purge' | |
alias ashow="_ashow" | |
_ashow() { | |
apt-cache show "$@" | grep -v "Description-md5" | grep -v "Priority: " | grep -v "Filename: " | grep -v "Installed-Size: " | grep -v "MD5sum: " | grep -v "SHA256: " | grep -v "Maintainer: " | grep -v "Architecture: " | grep -v "Version: " | grep -v "Version: " | grep -v "Depends: " | grep -v "Tag: " | grep -v "Size: " | while read -r line; do | |
_ITEM=$(echo "$line" | awk '{print $1}') | |
case $_ITEM in | |
"Package:") | |
echo "$line" | awk '{print $2}' | toilet -t -f fig.mono9 | colorize yellow | |
;; | |
'*') | |
echo "$line" | colorize green | |
;; | |
*) | |
echo "$line" | colorize cyan | |
;; | |
esac | |
done | bat | |
} | |
agrep() { | |
if [ "$1" == "-f" ]; then | |
_query=$(echo "$@" | sed 's|-f ||g') | |
echo "searching for $_query files in apt packages..." | |
apt-file search "$_query" | |
else | |
_RES=$(apt-cache search "$@" | while read -r line; do | |
_APP=$(echo -n "$line" | awk '{print $1}' | colorize cyan | tr -d '\n') | |
_DESC=$(echo -n "$line" | awk -F ' - ' '{print $2}' | colorize yellow) | |
echo -n -e "$_LIST$_APP|$_DESC\n" | |
done) | |
printf "Application|Description\n%s" "$_RES" | column -t -s"|" | bat | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment