7f98e1cb52d1bf42837f48ad4727d04a1cc5a4c8
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/debian/README.md b/plugins/debian/README.md
2index a676674dc9c2b9c429c05c07e555474f88555ef9..da5675c66b8623831917922e034fb7fd04397f62 100644
3--- a/plugins/debian/README.md
4+++ b/plugins/debian/README.md
5@@ -1,75 +1,85 @@
6 # debian
7
8-This plugin provides debian related zsh aliases.
9+This plugin provides Debian-related aliases and functions for zsh.
10+
11 To use it add `debian` to the plugins array in your zshrc file.
12
13 ```zsh
14 plugins=(... debian)
15 ```
16
17+## Settings
18+
19+- `$apt_pref`: use apt or aptitude if installed, fallback is apt-get.
20+- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
21+
22+Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
23+
24 ## Common Aliases
25
26-| Alias | Command | Description |
27-| -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- |
28-| `age` | apt-get | Command line tool for handling packages |
29-| `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation |
30-| `acs` | apt-cache search | Command line tool for searching apt software package cache |
31-| `aps` | aptitude search | Searches installed packages using aptitude |
32-| `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - |
33-| `afs` | apt-file search --regexp | Search file in packages |
34-| `asrc` | apt-get source | Fetch source packages through `apt-get` |
35-| `app` | apt-cache policy | Displays priority of package sources |
36+| Alias | Command | Description |
37+| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
38+| `age` | `apt-get` | Command line tool for handling packages |
39+| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
40+| `acs` | `apt-cache search` | Command line tool for searching apt software package cache |
41+| `aps` | `aptitude search` | Searches installed packages using aptitude |
42+| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
43+| `afs` | `apt-file search --regexp` | Search file in packages |
44+| `asrc` | `apt-get source` | Fetch source packages through `apt-get` |
45+| `app` | `apt-cache policy` | Displays priority of package sources |
46
47 ## Superuser Operations Aliases
48
49-| Alias | Command | Description |
50-| -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- |
51-| `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files |
52-| `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages |
53-| `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files |
54-| `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages |
55-| `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages |
56-| `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies |
57-| `afu` | sudo apt-file update | Update the files in packages |
58-| `au` | sudo $apt_pref $apt_upgr | - |
59-| `ai` | sudo $apt_pref install | Command-line tool to install package |
60-| `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 |
61-| `ap` | sudo $apt_pref purge | Removes packages along with configuration files |
62-| `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files |
63-| `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list |
64-| `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory |
65-| `di` | sudo dpkg -i | Install all .deb files in the current directory |
66-| `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 |
67-
68-- `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get.
69-- `$apt_upgr` - Use upgrade.
70+| Alias | Command | Description |
71+| -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
72+| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files |
73+| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages |
74+| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files |
75+| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages |
76+| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages |
77+| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies |
78+| `afu` | `sudo apt-file update` | Update the files in packages |
79+| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
80+| `ai` | `sudo $apt_pref install` | Command-line tool to install package |
81+| `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 |
82+| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files |
83+| `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files |
84+| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
85+| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
86+| `di` | `sudo dpkg -i` | Install all .deb files in the current directory |
87+| `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 |
88
89 ## Aliases - Commands using `su`
90
91-| Alias | Command |
92-| -------- | ------------------------------------------------------------------------------|
93-| `aac` | su -ls \'$apt_pref autoclean\' root |
94-| `ac` | su -ls \'$apt_pref clean\' root |
95-| `ad` | su -lc \'$apt_pref update\' root |
96-| `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root |
97-| `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root |
98-| `afu` | su -lc "apt-file update |
99-| `ag` | su -lc \'$apt_pref $apt_upgr\' root |
100-| `dia` | su -lc "dpkg -i ./*.deb" root |
101+| Alias | Command |
102+| ----- | --------------------------------------------------------- |
103+| `aac` | `su -ls "$apt_pref autoclean" root` |
104+| `ac` | `su -ls "$apt_pref clean" root` |
105diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
106index 654b692d2bcda339fd8b4fc5163c360e17f227e5..be4062ebff5568a3327f9c752026cf99174a0622 100644
107--- a/plugins/debian/debian.plugin.zsh
108+++ b/plugins/debian/debian.plugin.zsh
109@@ -1,25 +1,21 @@
110-# Authors:
111-# https://github.com/AlexBio
112-# https://github.com/dbb
113-# https://github.com/Mappleconfusers
114-#
115-# Debian-related zsh aliases and functions for zsh
116-
117 # Use apt or aptitude if installed, fallback is apt-get
118 # You can just set apt_pref='apt-get' to override it.
119-if [[ -e $( which -p apt 2>&1 ) ]]; then
120- apt_pref='apt'
121- apt_upgr='upgrade'
122-elif [[ -e $( which -p aptitude 2>&1 ) ]]; then
123- apt_pref='aptitude'
124- apt_upgr='safe-upgrade'
125-else
126- apt_pref='apt-get'
127- apt_upgr='upgrade'
128+
129+if [[ -z $apt_pref || -z $apt_upgr ]]; then
130+ if [[ -e $commands[apt] ]]; then
131+ apt_pref='apt'
132+ apt_upgr='upgrade'
133+ elif [[ -e $commands[aptitude] ]]; then
134+ apt_pref='aptitude'
135+ apt_upgr='safe-upgrade'
136+ else
137+ apt_pref='apt-get'
138+ apt_upgr='upgrade'
139+ fi
140 fi
141
142 # Use sudo by default if it's installed
143-if [[ -e $( which -p sudo 2>&1 ) ]]; then
144+if [[ -e $commands[sudo] ]]; then
145 use_sudo=1
146 fi
147
148@@ -32,8 +28,7 @@ alias api='aptitude'
149 # Some self-explanatory aliases
150 alias acs="apt-cache search"
151 alias aps='aptitude search'
152-alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
153- --no-gui --disable-columns search" # search package
154+alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
155
156 # apt-file
157 alias afs='apt-file search --regexp'
158@@ -46,49 +41,48 @@ alias app='apt-cache policy'
159 # superuser operations ######################################################
160 if [[ $use_sudo -eq 1 ]]; then
161 # commands using sudo #######
162- alias aac='sudo $apt_pref autoclean'
163- alias abd='sudo $apt_pref build-dep'
164- alias ac='sudo $apt_pref clean'
165- alias ad='sudo $apt_pref update'
166- alias adg='sudo $apt_pref update && sudo $apt_pref $apt_upgr'
167- alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
168- alias afu='sudo apt-file update'
169- alias au='sudo $apt_pref $apt_upgr'
170- alias ai='sudo $apt_pref install'
171+ alias aac="sudo $apt_pref autoclean"
172+ alias abd="sudo $apt_pref build-dep"
173+ alias ac="sudo $apt_pref clean"
174+ alias ad="sudo $apt_pref update"
175+ alias adg="sudo $apt_pref update && sudo $apt_pref $apt_upgr"
176+ alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
177+ alias afu="sudo apt-file update"
178+ alias au="sudo $apt_pref $apt_upgr"
179+ alias ai="sudo $apt_pref install"
180 # Install all packages given on the command line while using only the first word of each line:
181 # acs ... | ail
182- alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install'
183- alias ap='sudo $apt_pref purge'
184- alias ar='sudo $apt_pref remove'
185+ alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | xargs sudo $apt_pref install"
186+ alias ap="sudo $apt_pref purge"
187+ alias ar="sudo $apt_pref remove"
188
189 # apt-get only
190- alias ads='sudo apt-get dselect-upgrade'
191+ alias ads="sudo apt-get dselect-upgrade"
192
193 # Install all .deb files in the current directory.
194 # Warning: you will need to put the glob in single quotes if you use:
195 # glob_subst
196- alias dia='sudo dpkg -i ./*.deb'
197- alias di='sudo dpkg -i'
198+ alias dia="sudo dpkg -i ./*.deb"
199+ alias di="sudo dpkg -i"
200
201 # Remove ALL kernel images and headers EXCEPT the one in use
202- alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
203- ?not(~n`uname -r`))'
204+ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))'
205
206
207 # commands using su #########
208 else