Skip to content

Commit f802298

Browse files
authored
feat(ubuntu): add apt-fast support (ohmyzsh#13175)
1 parent 7ee92de commit f802298

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

plugins/ubuntu/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ plugins=(... ubuntu)
1010

1111
## Aliases
1212

13-
Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise.
13+
Commands that use `$APT` will use `apt-fast` if installed, or `apt` if installed, or defer to `apt-get`
14+
otherwise.
1415

1516
| Alias | Command | Description |
16-
|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
17+
| ------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
1718
| age | `sudo $APT` | Run apt-get with sudo |
1819
| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
1920
| acsp | `apt-cache showpkg` | Shows information about the listed packages |
@@ -26,7 +27,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
2627
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
2728
| agi | `sudo $APT install <pkg>` | Install the specified package |
2829
| agli | `apt list --installed` | List the installed packages |
29-
| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
30+
| aglu | `apt list --upgradable` | List available updates only |
3031
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
3132
| agr | `sudo $APT remove <pkg>` | Remove a package |
3233
| ags | `$APT source <pkg>` | Fetch the source for the specified package |
@@ -36,21 +37,20 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
3637
| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
3738
| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
3839
| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
39-
| 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 |
40+
| 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 |
4041
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
4142
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
4243

43-
4444
## Functions
4545

46-
| Function | Usage |Description |
47-
|-------------------|---------------------------------------|--------------------------------------------------------------------------|
46+
| Function | Usage | Description |
47+
| ----------------- | ------------------------------------- | ------------------------------------------------------------------------ |
4848
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
4949
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
5050
| apt-list-packages | `apt-list-packages` | List packages by size |
5151
| kerndeb | `kerndeb` | Kernel-package building shortcut |
5252

53-
## Authors:
53+
## Authors
5454

5555
- [@AlexBio](https://github.com/AlexBio)
5656
- [@dbb](https://github.com/dbb)
@@ -59,3 +59,4 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
5959
- [Nicolas Jonas](https://nextgenthemes.com)
6060
- [@loctauxphilippe](https://github.com/loctauxphilippe)
6161
- [@HaraldNordgren](https://github.com/HaraldNordgren)
62+
- [@AmrElsayyad](https://github.com/AmrElsayyad)

plugins/ubuntu/ubuntu.plugin.zsh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
(( $+commands[apt] )) && APT=apt || APT=apt-get
1+
# Detect available package manager (prefer apt-fast > apt > apt-get)
2+
if (( $+commands[apt-fast] )); then
3+
APT=apt-fast
4+
elif (( $+commands[apt] )); then
5+
APT=apt
6+
else
7+
APT=apt-get
8+
fi
29

310
alias acs='apt-cache search'
411

512
alias afs='apt-file search --regexp'
613

714
# These are apt/apt-get only
8-
alias ags="$APT source"
15+
if (( $+commands[apt] )); then
16+
alias ags="apt source"
17+
else
18+
alias ags="apt-get source"
19+
fi
920

1021
alias acp='apt-cache policy'
1122

0 commit comments

Comments
 (0)