prezto/modules/pacman/init.zsh
Kaleb Elwert e32a96be72 pacman: Simplify support for AUR helpers
There are a number of things happening here.

- Extra support for yaourt has been removed
- Docs have been updated to explicitly call out that AUR helpers are not
  officially supported
- aurutils has been suggested to make common operations easier
- A utility function called aurget (similar to aurfetch from aurutils)
  has been added to make cloning AUR repos easier.

Fixes #1531
2018-01-24 13:47:22 -08:00

89 lines
2.3 KiB
Bash

#
# Defines Pacman aliases.
#
# Authors:
# Benjamin Boudreau <dreurmail@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Tips:
# https://wiki.archlinux.org/index.php/Pacman_Tips
#
# Return if requirements are not found.
if (( ! $+commands[pacman] )); then
return 1
fi
#
# Frontend
#
# Get the Pacman frontend.
zstyle -s ':prezto:module:pacman' frontend '_pacman_frontend'
if (( $+commands[$_pacman_frontend] )); then
alias pacman="$_pacman_frontend"
else
_pacman_frontend='pacman'
_pacman_sudo='sudo '
fi
#
# Aliases
#
# Pacman.
alias pac="${_pacman_frontend}"
# Installs packages from repositories.
alias paci="${_pacman_sudo}${_pacman_frontend} --sync"
# Installs packages from files.
alias pacI="${_pacman_sudo}${_pacman_frontend} --upgrade"
# Removes packages and unneeded dependencies.
alias pacx="${_pacman_sudo}${_pacman_frontend} --remove"
# Removes packages, their configuration, and unneeded dependencies.
alias pacX="${_pacman_sudo}${_pacman_frontend} --remove --nosave --recursive"
# Displays information about a package from the repositories.
alias pacq="${_pacman_frontend} --sync --info"
# Displays information about a package from the local database.
alias pacQ="${_pacman_frontend} --query --info"
# Searches for packages in the repositories.
alias pacs="${_pacman_frontend} --sync --search"
# Searches for packages in the local database.
alias pacS="${_pacman_frontend} --query --search"
# Lists orphan packages.
alias pacman-list-orphans="${_pacman_sudo}${_pacman_frontend} --query --deps --unrequired"
# Removes orphan packages.
alias pacman-remove-orphans="${_pacman_sudo}${_pacman_frontend} --remove --recursive \$(${_pacman_frontend} --quiet --query --deps --unrequired)"
# Synchronizes the local package and Arch Build System databases against the
# repositories using the asp tool.
if (( $+commands[asp] )); then
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh && sudo asp update"
else
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh"
fi
# Synchronizes the local package database against the repositories then
# upgrades outdated packages.
alias pacU="${_pacman_sudo}${_pacman_frontend} --sync --refresh --sysupgrade"
function aurget {
local target_dir="$1"
if [[ -n "$2" ]]; then
target_dir="$2"
fi
git clone "https://aur.archlinux.org/$1" "$target_dir"
}
unset _pacman_{frontend,sudo}