Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Support file url in _urls
- X-seq: zsh-workers 8155
- From: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: Support file url in _urls
- Date: Thu, 07 Oct 1999 12:42:52 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Following is a patch to _urls to allow it to support the file url:
file://<tab> will complete from .zsh/urls as for http/ftp
file:/<tab> will complete files from root
file:<tab> inserts the current directory. I find this behaviour
(which is done in the compctl example) extremely useful.
There is one slight problem: if the current directory is root then the
compadd -S '/' ~+ line will add two slashes - one for the current
directory '/' and one for the suffix. I can't think of a simple way off
the top of my head to chop any trailing slash off the end of ~+.
What is the bookmark url scheme? Is it something specific to Netscape or
Lynx because if so, handling of it should move to _lynx/_netscape. Or,
maybe we need to provide a way of specifying which url schemes are supported.
Lynx supports a finger url for example.
I'm not entirely convinced by the system of taking urls from a directory
structure. At the least I think there should be an alternative. For
example, if $compconfig[urls_path] doesn't exist, the basic host names
should complete after (http|file|ftp)://. I would also like a compconfig
option which says that the local host is a web server, named X, doc root
in Y and users own web pages in directory Z within their home so files on
a local web server are completed.
One thing which I would like to implement is to restrict file types used
with urls. This would probably depend upon the browser (Netscape handles
graphics, Lynx doesn't etc) but the parameters to _url are passed to
both _files and compadd so I'm restricted in what I can do here.
Shouldn't _webbrowser be ditched and the first line of _urls be changed
to the #compdef - it would be cleaner in my opinion. The only problem is
that the -f option would be lost for those commands. We could always
negate its meaning though.
Any comments?
Oliver Kiddle
*** Completion/User/_urls.bak Thu Oct 7 12:03:33 1999
--- Completion/User/_urls Thu Oct 7 12:33:20 1999
***************
*** 46,58 ****
scheme="${PREFIX%%:*}"
compset -P "[-+.a-z0-9]#:"
else
! compadd "$@" -S '' http:// ftp:// bookmark:
return
fi
case "$scheme" in
! http) compset -P // || { compadd "$@" -S '' //; return };;
! ftp) compset -P // || { compadd "$@" -S '' //; return };;
esac
if [[ "$scheme" = bookmark &&
--- 46,68 ----
scheme="${PREFIX%%:*}"
compset -P "[-+.a-z0-9]#:"
else
! compadd "$@" -S '' http:// ftp:// bookmark: file:
return
fi
case "$scheme" in
! http|ftp) compset -P // || { compadd "$@" -S '' //; return };;
! file)
! if [[ -prefix // ]]; then
! compset -P //
! elif [ -prefix / ]; then
! _files "$@"
! return
! elif [ ! "$PREFIX" ]; then
! compadd -S '/' ~+
! return
! fi
! ;;
esac
if [[ "$scheme" = bookmark &&
Messages sorted by:
Reverse Date,
Date,
Thread,
Author