26e9cead1a7c9264962986fdc3038ad7266c92bd

Author
Felix Stupp <felix.stupp@outlook.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(plugins): Plugin "debian": Switch order of "apt" and "aptitude" for detection (#7533)

* Switch order of "apt" and "aptitude" for detection

"apt" is installed by default at Debian (maybe Ubuntu too), while "aptitude" does not seem to be installed by default.
For that, it may be better for most of the users to prefer "aptitude" if installed.

* plugins/debian/README: Change of order mirroded into documentation

Diff

 1diff --git a/plugins/debian/README.md b/plugins/debian/README.md
 2index da5675c66b8623831917922e034fb7fd04397f62..922d68cb3ba8c914e1776a2ce86c5fe5ad7f60b9 100644
 3--- a/plugins/debian/README.md
 4+++ b/plugins/debian/README.md
 5@@ -10,7 +10,7 @@ plugins=(... debian)
 6 
 7 ## Settings
 8 
 9-- `$apt_pref`: use apt or aptitude if installed, fallback is apt-get.
10+- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get.
11 - `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
12 
13 Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
14diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
15index 10839678483724b802e8e17741c5ac84eb79bf34..bde97cd308a422258e32902653dca0feba687b49 100644
16--- a/plugins/debian/debian.plugin.zsh
17+++ b/plugins/debian/debian.plugin.zsh
18@@ -1,13 +1,13 @@
19-# Use apt or aptitude if installed, fallback is apt-get
20+# Use aptitude or apt if installed, fallback is apt-get
21 # You can just set apt_pref='apt-get' to override it.
22 
23 if [[ -z $apt_pref || -z $apt_upgr ]]; then
24-    if [[ -e $commands[apt] ]]; then
25-        apt_pref='apt'
26-        apt_upgr='upgrade'
27-    elif [[ -e $commands[aptitude] ]]; then
28+    if [[ -e $commands[aptitude] ]]; then
29         apt_pref='aptitude'
30         apt_upgr='safe-upgrade'
31+    elif [[ -e $commands[apt] ]]; then
32+        apt_pref='apt'
33+        apt_upgr='upgrade'
34     else
35         apt_pref='apt-get'
36         apt_upgr='upgrade'