zsh-workers
 help / color / mirror / code / Atom feed
* Re: lftp completion
@ 2001-03-15 18:43 Oliver Kiddle
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2001-03-15 18:43 UTC (permalink / raw)
  To: zsh-workers

Sven wrote:

> How about a compromise: check if $HOME/.${words[0]:t}/bookmarks exists 
> and if it doesn't, fall back on $HOME/$service/bookmarks.

We could do that or we could use Bart's function with the style but I
think it would be better not to bother. As it stands,  it works for
lftp and ncftp. If we find other similar commands, then  we can think
about it all then. The most likely other candidates I can think of for
using this function are ncftpget, ncftpput and zftp which will all just
screw up either suggestion anyway.

The ncftp completion as committed by me on Sunday was not something I 
sat down to do a decent job of but was something which had been lying
in my functions directory for months and got committed because I was
doing a clear out and decided that it was more useful than default
completion. In fact, I seem to remember that it is a cut 'n' paste job
from _zftp. I've just looked at _zftp and it seems to be using the
bookmarks themselves so could use _ncftp. I was previously under the
impression that _zftp was taking full hostnames from the ncftp
bookmarks.

I think the whole host name completion thing possibly needs a bit of
thought. I've never really looked at all the _my_accounts and other,
similar mechanisms, I've only got a hosts style for _hosts. I'll need
to think about it more and look at some of the existing stuff but it
might be useful to have an _ftphosts which uses lftp, ncftp, zftp
bookmarks etc. What might be better is if _hosts takes various
parameters which specify things like: this is a
telnet/rsh/ftp/ssh/whatever connection or I've specified a user of
'opk' so only list hosts for which these users/connection types are
applicable, and an option to suggest inclusion of ncftp bookmarks.
_hosts could then use the parameters in combination with a few styles.
If anyone has any ideas, (including if you think it is all fine as it
is, let me know).

Oliver

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre. For further information visit
http://www.messagelabs.com/stats.asp


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lftp completion
  2001-03-13  5:24   ` Bart Schaefer
@ 2001-03-13 14:54     ` Chmouel Boudjnah
  0 siblings, 0 replies; 4+ messages in thread
From: Chmouel Boudjnah @ 2001-03-13 14:54 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

"Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

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

look ok for me..

-- 
MandrakeSoft Inc                     http://www.chmouel.org
                      --Chmouel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lftp completion
  2001-03-12  0:46 ` lftp completion Chmouel Boudjnah
@ 2001-03-13  5:24   ` Bart Schaefer
  2001-03-13 14:54     ` Chmouel Boudjnah
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-03-13  5:24 UTC (permalink / raw)
  To: zsh-workers

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   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* lftp completion
  2001-03-11 21:48 PATCH: various completion functions Oliver Kiddle
@ 2001-03-12  0:46 ` Chmouel Boudjnah
  2001-03-13  5:24   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Chmouel Boudjnah @ 2001-03-12  0:46 UTC (permalink / raw)
  To: zsh-workers


--- /dev/null   Thu Mar  8 11:12:32 2001
+++ Completion/User/_lftp       Mon Mar 12 01:44:31 2001
@@ -0,0 +1,5 @@
+#compdef lftp
+if [[ -f ~/.lftp/bookmarks ]]; then
+  _wanted bookmarks expl bookmark \
+      compadd - $(cut -f1 ~/.lftp/bookmarks) && return 0
+fi

-- 
MandrakeSoft Inc                     http://www.chmouel.org
                      --Chmouel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-03-15 18:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-15 18:43 lftp completion Oliver Kiddle
  -- strict thread matches above, loose matches on Subject: below --
2001-03-11 21:48 PATCH: various completion functions Oliver Kiddle
2001-03-12  0:46 ` lftp completion Chmouel Boudjnah
2001-03-13  5:24   ` Bart Schaefer
2001-03-13 14:54     ` Chmouel Boudjnah

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).