Last active
June 9, 2019 15:37
-
-
Save debxp/ad0a678236fd4c812d8d093dafff68c4 to your computer and use it in GitHub Desktop.
Meus aliases - apt
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
# ações cotidianas | |
alias up='sudo apt update' | |
alias upl='echo -e "$(apt list --upgradable 2>/dev/null)" | less' | |
alias upg='sudo apt upgrade' | |
alias apti='sudo apt install' | |
# busca pacotes instalados (sem argumentos=todos) | |
aptinstalled() { | |
echo "" | |
list="$(apt list --installed 2>/dev/null)" | |
if [[ $# -eq 0 ]]; then | |
less <<< $list | |
else | |
for pkg in "$@"; do | |
grep -e $pkg <<< $list | |
done | |
fi | |
echo "" | |
} | |
# info dos pacotes pesquisados | |
aptinfo() { apt-cache show "$@" | less; } | |
# busca pacotes disponíveis | |
aptsearch() { apt-cache search "$@" | sort | less; } | |
# Autocompletar dos aliases apt(x) | |
auto_complete_apt() { | |
mapfile -t COMPREPLY < <(apt-cache --no-generate pkgnames "$2"); | |
} | |
complete -F auto_complete_apt apti | |
complete -F auto_complete_apt aptsearch | |
complete -F auto_complete_apt aptinfo | |
complete -F auto_complete_apt aptinstalled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment