69f37800beb064445fad9c947ac24504609151cd

Author
Marc Cornellà <marc.cornella@live.com>
Committer
GitHub <noreply@github.com>
Date

Message

ubuntu: plugin cleanup and rename of ag alias to age (#7700)

* Clean up plugin and README
* Rename ag to age to avoid conflict with The Silver Searcher
  Fixes #3866

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md
  2index caa6a90b4b2247544495816f42dde91c68320c0b..f72182f5c88f4f73d215f5640f067ced3660696d 100644
  3--- a/plugins/ubuntu/README.md
  4+++ b/plugins/ubuntu/README.md
  5@@ -2,7 +2,7 @@
  6 
  7 This plugin adds completions and aliases for [Ubuntu](https://www.ubuntu.com/).
  8 
  9-To use it, add `ubuntu` to the plugins array in your zshrc file: 
 10+To use it, add `ubuntu` to the plugins array in your zshrc file:
 11 
 12 ```zsh
 13 plugins=(... ubuntu)
 14@@ -10,34 +10,34 @@ plugins=(... ubuntu)
 15 
 16 ## Aliases
 17 
 18-Commands that use `$APT` will use apt if installed or defer to apt-get otherwise. 
 19-
 20-| Alias   | Command                                                                | Description                                                                                       |
 21-|---------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
 22-| acs     | `apt-cache search`                                                     | Search the apt-cache with the specified criteria                                                  |
 23-| acp     | `apt-cache policy`                                                     | Display the package source priorities                                                             | 
 24-| afs     | `apt-file search --regexp`                                             | Perform a regular expression apt-file search                                                      |
 25-| afu     | `sudo apt-file update`                                                 | Generates or updates the apt-file package database                                                | 
 26-| ag      | `sudo $APT`                                                            | Run apt-get with sudo                                                                             | 
 27-| aga     | `sudo $APT autoclean`                                                  | Clears out the local reposityory of retrieved package files that can no longer be downloaded      | 
 28-| agb     | `sudo $APT build-dep <source_pkg>`                                     | Installs/Removes packages to satisfy the dependencies of a specified build pkg                    | 
 29-| agc     | `sudo $APT clean`                                                      | Clears out the local repository of retrieved package files leaving everything from the lock files | 
 30-| agd     | `sudo $APT dselect-upgrade`                                            | Follows dselect choices for package installation                                                  | 
 31-| agi     | `sudo $APT install <pkg>`                                              | Install the specified package                                                                     | 
 32-| agli    | `apt list --installed`                                                 | List the installed packages                                                                       | 
 33-| aglu    | `sudo apt-get -u upgrade --assume-no`                                  | Run an apt-get upgrade assuming no to all prompts                                                 | 
 34-| agp     | `sudo $APT purge <pkg>`                                                | Remove a package including any configuration files                                                | 
 35-| agr     | `sudo $APT remove <pkg>`                                               | Remove a package                                                                                  | 
 36-| ags     | `$APT source <pkg>`                                                    | Fetch the source for the specified package                                                        | 
 37-| agu     | `sudo $APT update`                                                     | Update package list                                                                               | 
 38-| agud    | `sudo $APT update && sudo $APT dist-upgrade`                           | Update packages list and perform a distribution upgrade                                           | 
 39-| agug    | `sudo $APT upgrade`                                                    | Upgrade available packages                                                                        | 
 40-| agar    | `sudo $APT autoremove`                                                 | Remove automatically installed packages no longer needed                                          | 
 41-| aguu    | `sudo $APT update && sudo $APT upgrade`                                | Update packages list and upgrade available packages                                               | 
 42-| allpkgs | `dpkg --get-selections \| grep -v deinstall`                           | Print all installed packages                                                                      | 
 43-| 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                                         |
 44-| mydeb   | `time dpkg-buildpackage -rfakeroot -us -uc`                            | Create a basic .deb package                                                                       |
 45-| ppap    | `sudo ppa-purge <ppa>`                                                 | Remove the specified PPA                                                                          | 
 46+Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise.
 47+
 48+| Alias   | Command                                                                  | Description                                                                                       |
 49+|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
 50+| age     | `sudo $APT`                                                              | Run apt-get with sudo                                                                             |
 51+| acs     | `apt-cache search`                                                       | Search the apt-cache with the specified criteria                                                  |
 52+| acp     | `apt-cache policy`                                                       | Display the package source priorities                                                             |
 53+| afs     | `apt-file search --regexp`                                               | Perform a regular expression apt-file search                                                      |
 54+| afu     | `sudo apt-file update`                                                   | Generates or updates the apt-file package database                                                |
 55+| aga     | `sudo $APT autoclean`                                                    | Clears out the local reposityory of retrieved package files that can no longer be downloaded      |
 56+| agb     | `sudo $APT build-dep <source_pkg>`                                       | Installs/Removes packages to satisfy the dependencies of a specified build pkg                    |
 57+| agc     | `sudo $APT clean`                                                        | Clears out the local repository of retrieved package files leaving everything from the lock files |
 58+| agd     | `sudo $APT dselect-upgrade`                                              | Follows dselect choices for package installation                                                  |
 59+| agi     | `sudo $APT install <pkg>`                                                | Install the specified package                                                                     |
 60+| agli    | `apt list --installed`                                                   | List the installed packages                                                                       |
 61+| aglu    | `sudo apt-get -u upgrade --assume-no`                                    | Run an apt-get upgrade assuming no to all prompts                                                 |
 62+| agp     | `sudo $APT purge <pkg>`                                                  | Remove a package including any configuration files                                                |
 63+| agr     | `sudo $APT remove <pkg>`                                                 | Remove a package                                                                                  |
 64+| ags     | `$APT source <pkg>`                                                      | Fetch the source for the specified package                                                        |
 65+| agu     | `sudo $APT update`                                                       | Update package list                                                                               |
 66+| agud    | `sudo $APT update && sudo $APT dist-upgrade`                             | Update packages list and perform a distribution upgrade                                           |
 67+| agug    | `sudo $APT upgrade`                                                      | Upgrade available packages                                                                        |
 68+| agar    | `sudo $APT autoremove`                                                   | Remove automatically installed packages no longer needed                                          |
 69+| aguu    | `sudo $APT update && sudo $APT upgrade`                                  | Update packages list and upgrade available packages                                               |
 70+| allpkgs | `dpkg --get-selections \| grep -v deinstall`                             | Print all installed packages                                                                      |
 71+| 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                                         |
 72+| mydeb   | `time dpkg-buildpackage -rfakeroot -us -uc`                              | Create a basic .deb package                                                                       |
 73+| ppap    | `sudo ppa-purge <ppa>`                                                   | Remove the specified PPA                                                                          |
 74 
 75 
 76 ## Functions
 77@@ -47,6 +47,14 @@ Commands that use `$APT` will use apt if installed or defer to apt-get otherwise
 78 | aar               | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
 79 | apt-history       | `apt-history <action>`                | Prints the Apt history of the specified action                           |
 80 | apt-list-packages | `apt-list-packages`                   | List packages by size                                                    |
 81-| kerndeb           | `kerndeb`                             | Kernel-package building shortcut                                         | 
 82+| kerndeb           | `kerndeb`                             | Kernel-package building shortcut                                         |
 83 
 84+## Authors:
 85 
 86+- [@AlexBio](https://github.com/AlexBio)
 87+- [@dbb](https://github.com/dbb)
 88+- [@Mappleconfusers](https://github.com/Mappleconfusers)
 89+- [@trinaldi](https://github.com/trinaldi)
 90+- [Nicolas Jonas](https://nextgenthemes.com)
 91+- [@loctauxphilippe](https://github.com/loctauxphilippe)
 92+- [@HaraldNordgren](https://github.com/HaraldNordgren)
 93diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh
 94index 198f06743c2867e755a060b099703db4eb449ffe..d589096c38251de2f279db000dc3af9178371dff 100644
 95--- a/plugins/ubuntu/ubuntu.plugin.zsh
 96+++ b/plugins/ubuntu/ubuntu.plugin.zsh
 97@@ -1,76 +1,43 @@
 98-# Authors:
 99-# https://github.com/AlexBio
100-# https://github.com/dbb
101-# https://github.com/Mappleconfusers
102-# https://github.com/trinaldi
103-# Nicolas Jonas nextgenthemes.com
104-# https://github.com/loctauxphilippe
105-# https://github.com/HaraldNordgren
106-#
107-# Debian, Ubuntu and friends related zsh aliases and functions for zsh
108-
109 (( $+commands[apt] )) && APT=apt || APT=apt-get
110 
111 alias acs='apt-cache search'
112-compdef _acs acs='apt-cache search'
113 
114 alias afs='apt-file search --regexp'
115-compdef _afs afs='apt-file search --regexp'
116 
117 # These are apt/apt-get only
118-alias ags="$APT source"   # asrc
119-compdef _ags ags="$APT source"
120+alias ags="$APT source"
121 
122-alias acp='apt-cache policy' # app
123-compdef _acp acp='apt-cache policy'
124+alias acp='apt-cache policy'
125 
126 #List all installed packages
127 alias agli='apt list --installed'
128-compdef _agli agli='apt list --installed'
129 
130 # superuser operations ######################################################
131 
132 # List available updates only
133 alias aglu='sudo apt-get -u upgrade --assume-no'
134-compdef _aglu aglu='sudo apt-get -u upgrade --assume-no'
135 
136 alias afu='sudo apt-file update'
137-compdef _afu afu='sudo apt-file update'
138 
139 alias ppap='sudo ppa-purge'
140-compdef _ppap ppap='sudo ppa-purge'
141-
142-alias ag="sudo $APT"               # age - but without sudo
143-alias aga="sudo $APT autoclean"    # aac
144-alias agb="sudo $APT build-dep"    # abd
145-alias agc="sudo $APT clean"        # adc
146-alias agd="sudo $APT dselect-upgrade" # ads
147-alias agi="sudo $APT install"      # ai
148-alias agp="sudo $APT purge"        # ap
149-alias agr="sudo $APT remove"       # ar
150-alias agu="sudo $APT update"       # ad
151-alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu
152-alias agug="sudo $APT upgrade"     # ag
153-alias aguu="sudo $APT update && sudo $APT upgrade"      #adg
154+
155+alias age="sudo $APT"
156+alias aga="sudo $APT autoclean"
157+alias agb="sudo $APT build-dep"
158+alias agc="sudo $APT clean"
159+alias agd="sudo $APT dselect-upgrade"
160+alias agi="sudo $APT install"
161+alias agp="sudo $APT purge"
162+alias agr="sudo $APT remove"
163+alias agu="sudo $APT update"
164+alias agud="sudo $APT update && sudo $APT dist-upgrade"
165+alias agug="sudo $APT upgrade"
166+alias aguu="sudo $APT update && sudo $APT upgrade"
167 alias agar="sudo $APT autoremove"
168 
169-compdef _ag ag="sudo $APT"
170-compdef _aga aga="sudo $APT autoclean"
171-compdef _agb agb="sudo $APT build-dep"
172-compdef _agc agc="sudo $APT clean"
173-compdef _agd agd="sudo $APT dselect-upgrade"
174-compdef _agi agi="sudo $APT install"
175-compdef _agp agp="sudo $APT purge"
176-compdef _agr agr="sudo $APT remove"
177-compdef _agu agu="sudo $APT update"
178-compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade"
179-compdef _agug agug="sudo $APT upgrade"
180-compdef _aguu aguu="sudo $APT update && sudo $APT upgrade"
181-compdef _agar agar="sudo $APT autoremove"
182 
183 # Remove ALL kernel images and headers EXCEPT the one in use
184-alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
185-	?not(~n`uname -r`))'
186+alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'
187 
188 # Misc. #####################################################################
189 # print all installed packages
190@@ -89,11 +56,11 @@ aar() {
191 	else
192 		read "PACKAGE?Type in the package name to install/upgrade with this ppa [${1##*/}]: "
193 	fi
194-	
195+
196 	if [ -z "$PACKAGE" ]; then