* PATCH: 5.3.1: allow included hosts to be completed
@ 2017-02-28 19:36 Jeremy Cantrell
0 siblings, 0 replies; only message in thread
From: Jeremy Cantrell @ 2017-02-28 19:36 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1.1: Type: text/plain, Size: 277 bytes --]
Sending this patch again after finding the instructions here:
http://www.zsh.org/mla/patches.shtml
Currently, only the main config file is looked at for host entries to offer
for completion. This patch modifies that behavior to also parse any
included files for host entries.
[-- Attachment #1.2: Type: text/html, Size: 375 bytes --]
[-- Attachment #2: zsh-ssh-host-completion.patch --]
[-- Type: text/x-patch, Size: 1204 bytes --]
--- /usr/share/zsh/functions/Completion/Unix/_ssh 2016-12-22 11:27:00.000000000 -0800
+++ packages/base/.local/share/zsh/functions/_ssh 2017-02-26 22:37:47.513422235 -0800
@@ -681,16 +681,21 @@
fi
if [[ -r $config ]]; then
local key hosts host
- while IFS=$'=\t ' read -r key hosts; do
- if [[ "$key" == (#i)host ]]; then
- for host in ${(z)hosts}; do
- case $host in
- (*[*?]*) ;;
- (*) config_hosts+=("$host") ;;
- esac
- done
- fi
- done < "$config"
+ local filename configs=($config)
+ grep '^Include\b' "$config" | sed 's/\s\+/ /g' | cut -d' ' -f2 |
+ while read -r filename; do
+ config=$HOME/.ssh/$filename
+ while IFS=$'=\t ' read -r key hosts; do
+ if [[ "$key" == (#i)host ]]; then
+ for host in ${(z)hosts}; do
+ case $host in
+ (*[*?]*) ;;
+ (*) config_hosts+=("$host") ;;
+ esac
+ done
+ fi
+ done < "$config"
+ done
if (( ${#config_hosts} )); then
_wanted hosts expl 'remote host name' \
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-02 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28 19:36 PATCH: 5.3.1: allow included hosts to be completed Jeremy Cantrell
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).