11 Commits
Author SHA1 Message Date
Fernando Araujo 74965c9609 feat(docker-compose): add dcv, dcsts and dci aliases (#14122) 2026-09-22 17:57:30 -07:00
Cedric Baaklini 1b2d741f19 feat(eza): add links, octal and inodes options (#14108) 2026-09-22 17:24:48 -07:00
Alexei Mironov 4ccc63333c feat(glab): add GitLab CLI completions (#14113)
Closes #13054
2026-09-22 17:23:21 -07:00
Robby RussellandCarlo Sala 40bddc3c1a perf(init): read the OMZ revision from .git instead of forking (#14063)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-09-22 17:46:15 +02:00
Robby RussellandClaude Fable 5.1 8d421b6309 fix(systemadmin): make the netstat fallback reachable (#14119)
Six helpers were written as `ss ... | awk ... || netstat ... | awk ...`.
A pipeline exits with its last command's status, so a missing ss still
ended in awk exiting 0 and the netstat branch never ran. On systems
without ss, sortcons, sortconip, req20, timewait20, syn20 and port_pro
printed nothing.

Each helper now picks ss or netstat by whether ss is installed. con80
gets the same shape so the file has one idiom and no longer prints
"command not found: ss" on the way to netstat. Where both backends
share the same columns, the awk program is written once.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 17:45:05 +02:00
Robby RussellandCarlo Sala 7d1b2a25ca feat(systemadmin)!: match ports 80 and 443 in con80, req20 and http20 (#14118)
BREAKING CHANGE: the default output of `con80` and `req20`
now includes port 443. `con80 80` gives the old result

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-09-22 17:42:41 +02:00
Dustin HackerandRobby Russell 86ef6555e0 feat(hermes): add hermes plugin (#14111)
Co-authored-by: Robby Russell <robby@planetargon.com>
2026-09-22 11:32:52 +02:00
Robby Russell 32d7277ac3 docs(gh): fix the completion cache path in the README (#14117) 2026-09-22 11:30:51 +02:00
Erik Huizinga e0d3557e14 fix(gradle): remove echo when running gradlew (#12893) 2026-09-21 13:28:03 -07:00
mattmc3 b6830a53d5 feat(otp): honour OTP_HOME and XDG_DATA_HOME (#12953) 2026-09-21 13:27:12 -07:00
manysuqandmanysuq fa82d8a3eb fix(frontend-search): use fallback search for dead dartlang docs URL (#14112)
Co-authored-by: manysuq <manysuq@users.noreply.github.com>
2026-09-21 13:14:56 -07:00
17 changed files with 282 additions and 43 deletions
+1
View File
@@ -5,6 +5,7 @@ plugins/eza/ @pepoluan
plugins/genpass/ @atoponce
plugins/git-lfs/ @hellovietduc
plugins/gitfast/ @felipec
plugins/hermes/ @Uhm-why
plugins/kube-ps1/ @mcornella
plugins/kubectl/ @mcornella
plugins/kubectx/ @mcornella
+82 -2
View File
@@ -131,9 +131,89 @@ if [[ -z "$ZSH_COMPDUMP" ]]; then
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi
# Construct zcompdump OMZ metadata
zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
# Resolve the commit $ZSH is checked out at into $REPLY by reading the git
# directory, so that no git process is forked on every startup.
# Handles .git files (worktrees, submodules), worktree common dirs, detached
# HEADs and packed refs. Returns 1 if anything is unexpected.
_omz_git_head() {
local gitdir="$ZSH/.git" common head ref
local -a lines
REPLY=
# .git may be a file pointing at the real git dir
if [[ -f "$gitdir" ]]; then
read -r head 2>/dev/null < "$gitdir" || return 1
[[ "$head" = "gitdir: "* ]] || return 1
gitdir="${head#gitdir: }"
[[ -n "$gitdir" ]] || return 1
[[ "$gitdir" = /* ]] || gitdir="$ZSH/$gitdir"
fi
# worktrees keep their refs in the common git dir
common="$gitdir"
if [[ -f "$gitdir/commondir" ]]; then
read -r common 2>/dev/null < "$gitdir/commondir" || return 1
[[ "$common" = /* ]] || common="$gitdir/$common"
fi
[[ -r "$gitdir/HEAD" ]] || return 1
read -r head 2>/dev/null < "$gitdir/HEAD" || return 1
if [[ "$head" = ref:\ * ]]; then
ref="${head#ref: }"
# Only use well-formed full ref names as paths. Besides matching Git's ref
# rules, this prevents a malformed HEAD from escaping the git directory.
[[ "$ref" = refs/?* \
&& "$ref" != *..* \
&& "$ref" != *//* \
&& "$ref" != */ \
&& "$ref" != */.* \
&& "$ref" != *.lock \
&& "$ref" != *.lock/* \
&& "$ref" != *. \
&& "$ref" != *'@{'* \
&& "$ref" != *[[:cntrl:]\ \~\^\:\?\*\[\\]* \
]] || return 1
case "$ref" in
# These namespaces are private to each worktree and are never resolved
# from the common directory or its packed-refs file.
refs/bisect/*|refs/worktree/*|refs/rewritten/*)
[[ -r "$gitdir/$ref" ]] || return 1
read -r REPLY 2>/dev/null < "$gitdir/$ref" || return 1
;;
*)
if [[ -r "$common/$ref" ]]; then
read -r REPLY 2>/dev/null < "$common/$ref" || return 1
elif [[ -r "$common/packed-refs" ]]; then
lines=("${(@f)$(<"$common/packed-refs")}")
REPLY="${lines[(r)* ${(b)ref}]%% *}"
else
return 1
fi
;;
esac
else
# detached HEAD: the file holds the commit itself
REPLY="$head"
fi
# only an object ID is a usable answer: a symbolic ref, a malformed file or
# a missed packed entry all fall through to the git fallback instead
[[ -n "$REPLY" && -z "${REPLY//[0-9a-f]/}" ]] \
&& (( ${#REPLY} == 40 || ${#REPLY} == 64 ))
}
# Construct zcompdump OMZ metadata. The helper reports through $REPLY, so
# call it in a scope that keeps that out of the global namespace.
() {
local REPLY
_omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
typeset -g zcompdump_revision="#omz revision: $REPLY"
}
zcompdump_fpath="#omz fpath: $fpath"
unset -f _omz_git_head
# Check whether the zcompdump file carries the current OMZ metadata lines
_omz_compdump_has_metadata() {
+4 -1
View File
@@ -17,7 +17,7 @@ plugins=(... docker-compose)
|-----------|----------------------------------|----------------------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers |
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
| dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container |
@@ -35,3 +35,6 @@ plugins=(... docker-compose)
| dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container |
| dck | `docker-compose kill` | Kills containers |
| dcv | `docker-compose version` | Show version information |
| dcsts | `docker-compose stats` | Show stats of containers |
| dci | `docker-compose images` | List images |
@@ -24,5 +24,8 @@ alias dclF="$dccmd logs -f --tail 0"
alias dcpull="$dccmd pull"
alias dcstart="$dccmd start"
alias dck="$dccmd kill"
alias dcv="$dccmd version"
alias dcsts="$dccmd stats"
alias dci="$dccmd images"
unset dccmd
+30
View File
@@ -45,6 +45,36 @@ If `yes`, always add `-h` flag to add a header row for each column.
Default: `no`
### `links`
```zsh
zstyle ':omz:plugins:eza' 'links' yes|no
```
If `yes`, always add `-H` flag to show hard links for each file.
Default: `no`
### `octal`
```zsh
zstyle ':omz:plugins:eza' 'octal' yes|no
```
If `yes`, always add `-o` flag to show file permissions as octal numbers.
Default: `no`
### `inodes`
```zsh
zstyle ':omz:plugins:eza' 'inodes' yes|no
```
If `yes`, always add `-i` flag to show the inode for each file.
Default: `no`
### `show-group`
```zsh
+9
View File
@@ -21,6 +21,15 @@ function _configure_eza() {
if zstyle -t ':omz:plugins:eza' 'header'; then
_EZA_HEAD+=("h")
fi
if zstyle -t ':omz:plugins:eza' 'links'; then
_EZA_HEAD+=("H")
fi
if zstyle -t ':omz:plugins:eza' 'octal'; then
_EZA_HEAD+=("o")
fi
if zstyle -t ':omz:plugins:eza' 'inodes'; then
_EZA_HEAD+=("i")
fi
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
case "${_val:l}" in
binary)
@@ -57,7 +57,7 @@ function frontend() {
codepen 'https://codepen.io/search/pens?q='
compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q='
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
dartlang $(_frontend_fallback 'dart.dev')
emberjs $(_frontend_fallback 'emberjs.com/')
flowtype $(_frontend_fallback 'flow.org/en/docs/')
fontello 'http://fontello.com/#search='
+1 -4
View File
@@ -17,7 +17,4 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH/plugins/gh/_gh` completions script
- `$ZSH_CACHE_DIR/gh_version` version of GitHub CLI, used to invalidate
the cache.
- `$ZSH_CACHE_DIR/completions/_gh` completions script
+18
View File
@@ -0,0 +1,18 @@
# GitLab CLI plugin
This plugin adds completion for the [GitLab CLI](https://docs.gitlab.com/cli/).
To use it, add `glab` to the plugins array in your zshrc file:
```zsh
plugins=(... glab)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script at `$ZSH_CACHE_DIR/completions/_glab`.
The cache is regenerated in the background whenever the plugin is loaded, which
usually happens when you start a new Zsh session.
+18
View File
@@ -0,0 +1,18 @@
# Autocompletion for the GitLab CLI (glab).
if (( ! $+commands[glab] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `glab`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_glab" ]]; then
typeset -g -A _comps
autoload -Uz _glab
_comps[glab]=_glab
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_glab"
zf_mv -f -- =( glab completion -s zsh ) "$TMPPREFIX"
} &|
-1
View File
@@ -15,7 +15,6 @@ function gradle-or-gradlew() {
# if gradlew found, run it instead of gradle
if [[ -f "$project_root/gradlew" ]]; then
echo "executing gradlew instead of gradle"
"$project_root/gradlew" "$@"
else
command gradle "$@"
+28
View File
@@ -0,0 +1,28 @@
# hermes plugin
This plugin adds completions for the Hermes AI agent.
To use it, add `hermes` to the plugin array in your zshrc file:
```zsh
plugins=(... hermes)
```
## Usage
```zsh
hermes <TAB>
```
## Common Workflows
```zsh
# First time setup/updating overall config
hermes setup
# Starting the tui chat
hermes
# Changing default model
hermes model
```
+15
View File
@@ -0,0 +1,15 @@
if (( ! $+commands[hermes] )); then
return
fi
if [[ ! -f "$ZSH_CACHE_DIR/completions/_hermes" ]]; then
typeset -g -A _comps
autoload -Uz _hermes
_comps[hermes]=_hermes
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hermes"
zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
} &|
+3 -1
View File
@@ -19,4 +19,6 @@ Provided aliases:
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin uses `$HOME/.otp` to store its internal files.
The plugin stores its internal files in `$OTP_HOME`, which can be set in your zshrc.
If `$OTP_HOME` is not set it defaults to either `$HOME/.otp` or `$XDG_DATA_HOME/otp`,
depending on whether `~/.otp` already exists, or whether `$XDG_DATA_HOME` is set.
+7 -1
View File
@@ -1,4 +1,10 @@
export OTP_HOME=~/.otp
if [[ -z "$OTP_HOME" ]]; then
if [[ ! -d "$HOME/.otp" ]] && [[ -n "$XDG_DATA_HOME" ]]; then
export OTP_HOME="$XDG_DATA_HOME/otp"
else
export OTP_HOME=~/.otp
fi
fi
mkdir -p $OTP_HOME
function ot () {
+3 -3
View File
@@ -33,10 +33,10 @@ plugins=(... systemadmin)
| killit | Kills any process that matches a regular expression passed to it |
| tree | List contents of directories in a tree-like format (if tree isn't installed) |
| sortcons | Sort connections by state |
| con80 | View all 80 Port Connections |
| con80 | View all connections on ports 80 and 443, or on the ports given as arguments (`con80 8080`) |
| sortconip | On the connected IP sorted by the number of connections |
| req20 | List the top 20 requests on port 80 |
| http20 | List the top 20 connections to port 80 based on tcpdump data |
| req20 | List the top 20 requests on ports 80 and 443, or on the ports given as arguments (`req20 8080`) |
| http20 | List the top 20 connections to ports 80 and 443 based on tcpdump data, or to the ports given as arguments |
| timewait20 | List the top 20 time_wait connections |
| syn20 | List the top 20 SYN connections |
| port_pro | Output all processes according to the port number |
+59 -29
View File
@@ -65,60 +65,90 @@ fi
# Sort connection state
function sortcons() {
{
LANG= ss -nat | awk 'NR > 1 {print $1}' \
|| LANG= netstat -nat | awk 'NR > 2 {print $6}'
} | sort | uniq -c | sort -rn
if (( $+commands[ss] )); then
LANG= ss -nat | awk 'NR > 1 {print $1}'
else
LANG= netstat -nat | awk 'NR > 2 {print $6}'
fi | sort | uniq -c | sort -rn
}
# View all 80 Port Connections
function _systemadmin_validate_ports() {
local port
for port in "$@"; do
if [[ $port != <0-65535> || ( $port == 0* && $port != 0 ) ]]; then
print -u2 "systemadmin: invalid port '$port' (expected 0 to 65535 without leading zeros)"
return 1
fi
done
}
# View all connections on the given ports (default 80 and 443)
function con80() {
{
LANG= ss -nat || LANG= netstat -nat
} | grep -E ":80[^0-9]" | wc -l
local -a ports=("$@")
(( $# )) || ports=(80 443)
_systemadmin_validate_ports "${ports[@]}" || return
if (( $+commands[ss] )); then
LANG= ss -nat
else
LANG= netstat -nat
fi | grep -E ":(${(j:|:)ports})([[:space:]]|$)" | wc -l
}
# On the connected IP sorted by the number of connections
function sortconip() {
{
LANG= ss -ntu | awk 'NR > 1 {print $6}' \
|| LANG= netstat -ntu | awk 'NR > 2 {print $5}'
} | cut -d: -f1 | sort | uniq -c | sort -n
if (( $+commands[ss] )); then
LANG= ss -ntu | awk 'NR > 1 {print $6}'
else
LANG= netstat -ntu | awk 'NR > 2 {print $5}'
fi | cut -d: -f1 | sort | uniq -c | sort -n
}
# top20 of Find the number of requests on 80 port
# top20 of Find the number of requests on the given ports (default 80 and 443)
function req20() {
{
LANG= ss -tn | awk '$4 ~ /:80$/ {print $5}' \
|| LANG= netstat -tn | awk '$4 ~ /:80$/ {print $5}'
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
local -a ports=("$@")
(( $# )) || ports=(80 443)
_systemadmin_validate_ports "${ports[@]}" || return
if (( $+commands[ss] )); then
LANG= ss -tn
else
LANG= netstat -tn
fi | awk -v ports="${(j:|:)ports}" '$4 ~ ":("ports")$" {print $5}' \
| awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
}
# top20 of Using tcpdump port 80 access to view
# top20 of Using tcpdump to view access to the given ports (default 80 and 443)
function http20() {
sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
local -a ports=("$@")
(( $# )) || ports=(80 443)
_systemadmin_validate_ports "${ports[@]}" || return
sudo tcpdump -i eth0 -tnn -c 1000 "dst port ${(j: or :)ports}" | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
}
# top20 of Find time_wait connection
function timewait20() {
{
LANG= ss -nat | awk 'NR > 1 && /TIME-WAIT/ {print $5}' \
|| LANG= netstat -nat | awk 'NR > 2 && /TIME_WAIT/ {print $5}'
} | sort | uniq -c | sort -rn | head -n 20
if (( $+commands[ss] )); then
LANG= ss -nat
else
LANG= netstat -nat
fi | awk '/TIME[-_]WAIT/ {print $5}' | sort | uniq -c | sort -rn | head -n 20
}
# top20 of Find SYN connection
function syn20() {
{
LANG= ss -an | awk '/SYN/ {print $5}' \
|| LANG= netstat -an | awk '/SYN/ {print $5}'
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
if (( $+commands[ss] )); then
LANG= ss -an
else
LANG= netstat -an
fi | awk '/SYN/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
}
# Printing process according to the port number
function port_pro() {
LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/' \
|| LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
if (( $+commands[ss] )); then
LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/'
else
LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
fi
}
# top10 of gain access to the ip address