From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7341 invoked by alias); 26 May 2017 04:53:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41159 Received: (qmail 960 invoked from network); 26 May 2017 04:53:23 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.41):SA:0(-0.0/5.0):. Processed in 1.335017 secs); 26 May 2017 04:53:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.41 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=MItNLoe4q49nFzBxvGYXy6ZE0Ir0fgKpxz4bsNQm9LY=; b=bzpx2VviMxITYY6fXA+T8ISkYsg5wO0UKJLeTZZC5kgdXnD9CyLAK/+7viu7g+klT3 vALLeG4KpuHzIBu8QM36uU6fa5iEQNVK8JMl6+kDzH+f0TC6wPIchg+vAUOt4d4KiQ1r /5IOqnpeEmuIUduehd/XxHdpdcmc/mXAOgl7u67CacY+CbFU7RuHrH+7r8l45hFwKRbV hYtlWSI2Y4JgyX+DvOBvcqYXgp9NnCGDDzqGWWErEzn+Hj1E5o10cw3abbe4psH8JNcC HbQsXMpBi6VylW/4Bcctk1ZJNoT/7XHhZgq/wLwNUYnhrE80hELkZERaimWuQokUUBqn HJRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=MItNLoe4q49nFzBxvGYXy6ZE0Ir0fgKpxz4bsNQm9LY=; b=o+T5hbcU3WqCQd47imHoT/NeI+UYD+Lgo4uIzXvsUegdutfKxSCS5JgqclSv7fDyrZ MZoGmP1iC0qYzNvTZ36ZzzgywnNqqIsWh2Trqg/965o8vpZUNeMHX4BWl4EDb2id2zO/ ki/ryfo5ZRgA7zxa6P81UgZU7e76h3V36E/nxDuwR5QtoUUW8R5lq34DzCFR9SHYaCJJ obVO3Ygf2waIxOvEr4Emjg9NSaVZjZPsaV7hwgzgJN3N+4vP0+MVse8nMphMYtxlzSAo vfap2QUODpUcidwgyjf8OylfBHUMIFu7Lf5EUzOUmbsGSazc01aqqVGH5zFfvnNXC/3N GZyw== X-Gm-Message-State: AODbwcAnRUmr7i+xWMt4LHAwIOW4RPSaYRRHa7wVBnyvblwNb092wo9Q hnfgaW4yZnS2DYL3rBo= X-Received: by 10.31.107.81 with SMTP id g78mr11058vkc.13.1495774395428; Thu, 25 May 2017 21:53:15 -0700 (PDT) From: Bart Schaefer Message-Id: <170525215320.ZM20457@torch.brasslantern.com> Date: Thu, 25 May 2017 21:53:20 -0700 In-Reply-To: Comments: In reply to Nikola Milojevic "ZSH SSH completion with new Include directive in OpenSSH" (May 25, 9:51am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: ZSH SSH completion with new Include directive in OpenSSH MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 25, 9:51am, Nikola Milojevic wrote: } } I've stumbled upon that ssh completion doesn't work with the new Include } directive in OpenSSH 7.3. That commands include ssh config files from the } custom folder you set. } } Do you have it in a roadmap to fix that? I've forgotten again now why we have this: # If users-hosts matches, we shouldn't complete anything else. My ~/.ssh/config is never read, period, because users-hosts always returns something. Nevertheless I suppose you're looking for something like the following (the "Match" directive is unlikely ever to be interpreted): diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 6763e24..cd106ad 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -680,17 +680,23 @@ _ssh_hosts () { config="$HOME/.ssh/config" 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 key line host + local -a lines=("${(@f)$(<"$config")}") + while (($#lines)); do + IFS=$'=\t ' read -r key line <<<"${lines[1]}" + case "$key" in + ((#i)include) + lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}");; + ((#i)host(|name)) + for host in ${(z)line}; do + case $host in + (*[*?]*) ;; + (*) config_hosts+=("$host") ;; + esac + done; ;& + (*) shift lines;; + esac + done if (( ${#config_hosts} )); then _wanted hosts expl 'remote host name' \ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts