Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: _long_options
- X-seq: zsh-workers 5679
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: _long_options
- Date: Mon, 8 Mar 1999 11:31:42 +0100 (MET)
- In-reply-to: Sven Wischnowsky's message of Mon, 8 Mar 1999 11:03:38 +0100 (MET)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Aargh, I remembered this a bit too late...
If `_long_options' thinks the command invoked is a path name relative
to PWD it probably should put `$PWD' before it to make sure the cache
isn't used for another command that happens to have the same name but
is in a different directory.
I had this idea when playing with `_tar' (which is not changed, yet):
there we probably should try to turn the archive name into a absolute
path when building the cache name. Would
tf="$PWD/$tf"
tf="${${tf//.\\/}//\\/[^/]#\\/..}"
be enough for that? (Looks funny, doesn't it? ;-)
Bye
Sven
diff -u oc/User/_long_options Completion/User/_long_options
--- oc/User/_long_options Mon Mar 8 11:22:18 1999
+++ Completion/User/_long_options Mon Mar 8 11:28:43 1999
@@ -58,11 +58,17 @@
# We cache the information about options and the command name, see if
# we can use the cache.
-if [[ "$words[1]" != $_lo_cache_cmd ]]; then
+if [[ "$words[1]" = (.|..)/* ]]; then
+ tmp="$PWD/$words[1]"
+else
+ tmp="$words[1]"
+fi
+
+if [[ "$tmp" != $_lo_cache_cmd ]]; then
# No, store the new command name and clear the old parameters.
- _lo_cache_cmd="$words[1]"
+ _lo_cache_cmd="$tmp"
(( $+_lo_cache_actions )) && unset ${_lo_cache_actions%% *} _lo_cache_actions
local opts pattern anum=1 tmpo str
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author