Compare commits

...

4 Commits

Author SHA1 Message Date
relaxin101 4a26ceb848
Merge b0c3eb32f5 into cae2e45193 2025-01-10 17:50:24 +01:00
Thomas cae2e45193
fix(rust): call `rustc` through `rustup run` (#12901) 2025-01-10 14:17:49 +01:00
Carlo Sala 276e540eed
fix(cli): ensure `ksharrays` is unset
Closes #12900
2025-01-10 14:11:33 +01:00
relax b0c3eb32f5 fix: Added support for include in config file to ssh plugin 2024-09-25 01:52:47 +02:00
3 changed files with 47 additions and 10 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
function omz {
setopt localoptions noksharrays
[[ $# -gt 0 ]] || {
_omz::help
return 1

View File

@ -22,5 +22,5 @@ fi
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
#compdef cargo
source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo
EOF

View File

@ -4,16 +4,52 @@
# Filter out wildcard host sections.
_ssh_configfile="$HOME/.ssh/config"
if [[ -f "$_ssh_configfile" ]]; then
_ssh_hosts=($(
egrep '^Host.*' "$_ssh_configfile" |\
parse_ssh_config() {
local config_file="$1"
if [[ -f "$config_file" ]]; then
# Extract all "Host" entries
local hosts=($(
egrep -i '^Host.*' "$config_file" |\
awk '{for (i=2; i<=NF; i++) print $i}' |\
sort |\
uniq |\
grep -v '^*' |\
sed -e 's/\.*\*$//'
))
zstyle ':completion:*:hosts' hosts $_ssh_hosts
# Add hosts to the global array
_ssh_hosts+=("${hosts[@]}")
# Handle Include directives by reading the files they reference
local includes=($(egrep '^Include ' "$config_file" | awk '{print $2}'))
# Loop through each included file or pattern
for include in "${includes[@]}"; do
# Resolve relative paths and handle wildcards
for file in $(eval echo $include); do
parse_ssh_config "$file"
done
done
fi
}
_ssh_hosts=()
# Start parsing from the main SSH config file
_ssh_configfile="$HOME/.ssh/config"
parse_ssh_config "$_ssh_configfile"
_final_hosts=($(sort <<< "${_ssh_hosts[@]}" |\
uniq |\
grep -v '^*' |\
sed -e 's/\.*\*$//'
))
zstyle ':completion:*:hosts' hosts $_final_hosts
unset _ssh_hosts
unset _final_hosts
fi
unset _ssh_configfile