From 02f14a9cb152561a5e44062aac79f3b700403b40 Mon Sep 17 00:00:00 2001 From: navewindre Date: Sun, 13 Jul 2025 06:42:05 +0200 Subject: omz --- home/.oh-my-zsh/plugins/dnf/README.md | 32 ++ home/.oh-my-zsh/plugins/dnf/_dnf5 | 570 +++++++++++++++++++++++++++++ home/.oh-my-zsh/plugins/dnf/dnf.plugin.zsh | 19 + 3 files changed, 621 insertions(+) create mode 100644 home/.oh-my-zsh/plugins/dnf/README.md create mode 100644 home/.oh-my-zsh/plugins/dnf/_dnf5 create mode 100644 home/.oh-my-zsh/plugins/dnf/dnf.plugin.zsh (limited to 'home/.oh-my-zsh/plugins/dnf') diff --git a/home/.oh-my-zsh/plugins/dnf/README.md b/home/.oh-my-zsh/plugins/dnf/README.md new file mode 100644 index 0000000..f45c877 --- /dev/null +++ b/home/.oh-my-zsh/plugins/dnf/README.md @@ -0,0 +1,32 @@ +# dnf plugin + +This plugin makes `dnf` usage easier by adding aliases for the most common commands. + +`dnf` is the new package manager for RPM-based distributions, which replaces `yum`. + +To use it, add `dnf` to the plugins array in your zshrc file: + +```zsh +plugins=(... dnf) +``` + +Classic `dnf` is getting superseded by `dnf5`; this plugin detects the presence +of `dnf5` and uses it as drop-in alternative to the slower `dnf`. + +## Aliases + +| Alias | Command | Description | +|-------|-------------------------|--------------------------| +| dnfl | `dnf list` | List packages | +| dnfli | `dnf list installed` | List installed packages | +| dnfgl | `dnf grouplist` | List package groups | +| dnfmc | `dnf makecache` | Generate metadata cache | +| dnfp | `dnf info` | Show package information | +| dnfs | `dnf search` | Search package | +| **Use `sudo`** | +| dnfu | `sudo dnf upgrade` | Upgrade package | +| dnfi | `sudo dnf install` | Install package | +| dnfgi | `sudo dnf groupinstall` | Install package group | +| dnfr | `sudo dnf remove` | Remove package | +| dnfgr | `sudo dnf groupremove` | Remove package group | +| dnfc | `sudo dnf clean all` | Clean cache | diff --git a/home/.oh-my-zsh/plugins/dnf/_dnf5 b/home/.oh-my-zsh/plugins/dnf/_dnf5 new file mode 100644 index 0000000..9cbf451 --- /dev/null +++ b/home/.oh-my-zsh/plugins/dnf/_dnf5 @@ -0,0 +1,570 @@ +#compdef dnf5 +# based on dnf-5.2.6.2 + +# utility functions + +_dnf5_helper() { + _call_program specs $service "${(q-)@}" "${(q-)PREFIX}\*" \ + -qC --assumeno --nogpgcheck 2>/dev/null command' '*:: :->cmd_args' && ret=0 + + case $state in + command) _dnf5_commands && ret=0 ;; + cmd_args) _dnf5_subcmds_opts && ret=0 ;; + esac + return ret +} + +_dnf5 "$@" diff --git a/home/.oh-my-zsh/plugins/dnf/dnf.plugin.zsh b/home/.oh-my-zsh/plugins/dnf/dnf.plugin.zsh new file mode 100644 index 0000000..642422f --- /dev/null +++ b/home/.oh-my-zsh/plugins/dnf/dnf.plugin.zsh @@ -0,0 +1,19 @@ +## Aliases +local dnfprog="dnf" + +# Prefer dnf5 if installed +command -v dnf5 > /dev/null && dnfprog=dnf5 + +alias dnfl="${dnfprog} list" # List packages +alias dnfli="${dnfprog} list installed" # List installed packages +alias dnfgl="${dnfprog} grouplist" # List package groups +alias dnfmc="${dnfprog} makecache" # Generate metadata cache +alias dnfp="${dnfprog} info" # Show package information +alias dnfs="${dnfprog} search" # Search package + +alias dnfu="sudo ${dnfprog} upgrade" # Upgrade package +alias dnfi="sudo ${dnfprog} install" # Install package +alias dnfgi="sudo ${dnfprog} groupinstall" # Install package group +alias dnfr="sudo ${dnfprog} remove" # Remove package +alias dnfgr="sudo ${dnfprog} groupremove" # Remove package group +alias dnfc="sudo ${dnfprog} clean all" # Clean cache -- cgit v1.2.3