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

Re: lftp completion



Chmouel's _lftp function is very similar to _ncftp.  Here's a single
function that handles both, without resorting to "awk -F" or "cut":

---- 8< ---- snip ---- 8< ----
#compdef ncftp lftp

local bookmarks=$HOME/.${words[0]:t}/bookmarks

if [[ -f $bookmarks ]]; then
  bookmarks=(${"${(f)$(<$bookmarks)}"%%[[:space:],]*})
  [[ ${words[0]:t} == ncftp ]] && shift 2 bookmarks  
  _wanted bookmarks expl bookmark compadd -a bookmarks && return 0
fi

_hosts
---- 8< ---- snip ---- 8< ----

Any object to replacing _ncftp with the above and removing _lftp?  (One
possible objection might be that lftp allows commas in its bookmark
names; I don't know whether or not that's the case.)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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