Skip to content

Instantly share code, notes, and snippets.

@yunginnanet
Last active September 16, 2021 11:25
Show Gist options
  • Save yunginnanet/9f75ac5f0b7d0e8dbae442ea11150611 to your computer and use it in GitHub Desktop.
Save yunginnanet/9f75ac5f0b7d0e8dbae442ea11150611 to your computer and use it in GitHub Desktop.
aliases for colorful, tableified apt-cache show and apt-cache search
#!/usr/bin/env bash
# preview: https://tcp.ac/i/J7RAJ
agrep() {
_RES=$(apt-cache search "$@" | while read 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$_RES" | column -t -s"|" | batcat
}
ashow() {
apt-cache show "$@" | grep -v "Description-md5" | grep -v "Priority: " | grep -v "Filename: " | grep -v "Insta>
_ITEM=$(echo $line | awk '{print $1}')
case $_ITEM in
"Package:")
echo "$line" | awk '{print $2}' | toilet -f fig.mono9 | colorize yellow
;;
'*')
echo "$line" | colorize green
;;
*)
echo "$line" | colorize cyan
;;
esac;
done | batcat
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment