Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: path expansion on remote host



On Tue, Jun 10, 2014 at 7:24 AM, Sepp Tannhuber <sepp.tannhuber@xxxxxxxx>
wrote:

>
> But when I do the same on a remote host
>   scp user@remotehost:/u/lo/li
> the expansion fails.
>

Partial path expansion depends on having access to the filesystem to
examine each component of the directory in turn, i.e., find what may be
many possible completions for the first component, then look again below
those possible matches for completions of the next component, etc. -- a
full tree search.  It should be pretty obvious that a remote system's files
aren't readily available for that.  The remote system might not even have
zsh, and even if it does would not have the completion system loaded
because it's not an interactive shell, so there's nothing available on the
remote system to perform that tree search.

To "fix" this, you'd have to re-implement the _path_files helper function
to do remote shell accesses for every level of tree search that it locally
performs with simple globbing, and then you'd have to be willing to pay the
time/network cost for a potentially very large number of round-trips to the
remote system while the search proceeds.  In the end you'd probably find
it's faster to just type remotehost:/u<TAB>/lo<TAB>/li<TAB>.

(There is an alternative, which would be to use _multi_parts as is used on
e.g. tar archives, but that would require dumping a recursive listing of
most of the remote filesystem over the network so that it could be searched
locally for matches.  I don't think you want that either.)


Messages sorted by: Reverse Date, Date, Thread, Author