From 7f98e1cb52d1bf42837f48ad4727d04a1cc5a4c8 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 11 Jun 2019 15:02:04 +0200 Subject: debian: fix alias completion, rename ag and clean up README (#7698) * Use double quotes to cache value of $apt_pref and $apt_upgr * Clean up and fix syntax of command checks * Clean up README and document $apt_pref/$apt_upgr overriding mechanism * Rename `ag` alias (apt upgrade) to `au` * Clean up README and fix syntax Fixes #3686 Fixes #4660 Closes #5906 Co-authored-by: Noah Vesely --- plugins/debian/README.md | 114 ++++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 52 deletions(-) (limited to 'plugins/debian/README.md') diff --git a/plugins/debian/README.md b/plugins/debian/README.md index a676674dc..da5675c66 100644 --- a/plugins/debian/README.md +++ b/plugins/debian/README.md @@ -1,75 +1,85 @@ # debian -This plugin provides debian related zsh aliases. +This plugin provides Debian-related aliases and functions for zsh. + To use it add `debian` to the plugins array in your zshrc file. ```zsh plugins=(... debian) ``` +## Settings + +- `$apt_pref`: use apt or aptitude if installed, fallback is apt-get. +- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude). + +Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior. + ## Common Aliases -| Alias | Command | Description | -| -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- | -| `age` | apt-get | Command line tool for handling packages | -| `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation | -| `acs` | apt-cache search | Command line tool for searching apt software package cache | -| `aps` | aptitude search | Searches installed packages using aptitude | -| `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - | -| `afs` | apt-file search --regexp | Search file in packages | -| `asrc` | apt-get source | Fetch source packages through `apt-get` | -| `app` | apt-cache policy | Displays priority of package sources | +| Alias | Command | Description | +| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- | +| `age` | `apt-get` | Command line tool for handling packages | +| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options | +| `acs` | `apt-cache search` | Command line tool for searching apt software package cache | +| `aps` | `aptitude search` | Searches installed packages using aptitude | +| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format | +| `afs` | `apt-file search --regexp` | Search file in packages | +| `asrc` | `apt-get source` | Fetch source packages through `apt-get` | +| `app` | `apt-cache policy` | Displays priority of package sources | ## Superuser Operations Aliases -| Alias | Command | Description | -| -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- | -| `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files | -| `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages | -| `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files | -| `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages | -| `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages | -| `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies | -| `afu` | sudo apt-file update | Update the files in packages | -| `au` | sudo $apt_pref $apt_upgr | - | -| `ai` | sudo $apt_pref install | Command-line tool to install package | -| `ail` | sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install | Install all packages given on the command line while using only the first word of each line | -| `ap` | sudo $apt_pref purge | Removes packages along with configuration files | -| `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files | -| `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list | -| `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory | -| `di` | sudo dpkg -i | Install all .deb files in the current directory | -| `kclean` | sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`)) | Remove ALL kernel images and headers EXCEPT the one in use | - -- `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get. -- `$apt_upgr` - Use upgrade. +| Alias | Command | Description | +| -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files | +| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages | +| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files | +| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages | +| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages | +| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies | +| `afu` | `sudo apt-file update` | Update the files in packages | +| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades | +| `ai` | `sudo $apt_pref install` | Command-line tool to install package | +| `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line | +| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files | +| `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files | +| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list | +| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory | +| `di` | `sudo dpkg -i` | Install all .deb files in the current directory | +| `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use | ## Aliases - Commands using `su` -| Alias | Command | -| -------- | ------------------------------------------------------------------------------| -| `aac` | su -ls \'$apt_pref autoclean\' root | -| `ac` | su -ls \'$apt_pref clean\' root | -| `ad` | su -lc \'$apt_pref update\' root | -| `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root | -| `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root | -| `afu` | su -lc "apt-file update | -| `ag` | su -lc \'$apt_pref $apt_upgr\' root | -| `dia` | su -lc "dpkg -i ./*.deb" root | +| Alias | Command | +| ----- | --------------------------------------------------------- | +| `aac` | `su -ls "$apt_pref autoclean" root` | +| `ac` | `su -ls "$apt_pref clean" root` | +| `ad` | `su -lc "$apt_pref update" root` | +| `adg` | `su -lc "$apt_pref update && aptitude $apt_upgr" root` | +| `adu` | `su -lc "$apt_pref update && aptitude dist-upgrade" root` | +| `afu` | `su -lc "apt-file update"` | +| `au` | `su -lc "$apt_pref $apt_upgr" root` | +| `dia` | `su -lc "dpkg -i ./*.deb" root` | ## Miscellaneous Aliases -| Alias | Command | Description | -| -------- | -------------------------------------------------|---------------------------------------- | -| `allpkgs`| aptitude search -F "%p" --disable-columns ~i | Display all installed packages | -| `mydeb` | time dpkg-buildpackage -rfakeroot -us -uc | Create a basic .deb package | +| Alias | Command | Description | +| --------- | ---------------------------------------------- | ------------------------------ | +| `allpkgs` | `aptitude search -F "%p" --disable-columns ~i` | Display all installed packages | +| `mydeb` | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package | ## Functions -| Fucntion | Description | -|-----------------------|-------------------------------------------------------------------------------| -| `apt-copy` | Create a simple script that can be used to 'duplicate' a system | -| `apt-history` | Displays apt history for a command | -| `kerndeb` | Builds kernel packages | -| `apt-list-packages` | List packages by size | +| Function | Description | +| ------------------- | --------------------------------------------------------------- | +| `apt-copy` | Create a simple script that can be used to 'duplicate' a system | +| `apt-history` | Displays apt history for a command | +| `kerndeb` | Builds kernel packages | +| `apt-list-packages` | List packages by size | + +## Authors +- [@AlexBio](https://github.com/AlexBio) +- [@dbb](https://github.com/dbb) +- [@Mappleconfusers](https://github.com/Mappleconfusers) -- cgit v1.2.3-70-g09d2