zsh-workers
 help / color / mirror / code / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: zsh-workers@zsh.org
Subject: [PATCH] fix zfdir -r
Date: Wed, 27 May 2015 14:22:13 +0800	[thread overview]
Message-ID: <20150527062213.GA28760@localhost.localdomain> (raw)

First, This patch try to fix the problem that 'zfdir -r' works just
like 'zfdir': they both show contents of current directory.

Then, with this patch if 'newdir' in 'zfdir -r newdir' is different
to the dir in last 'zfdir dir', the effect of '-r' will be canceled.
---
 Functions/Zftp/zfdir | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Functions/Zftp/zfdir b/Functions/Zftp/zfdir
index 4818dc9..5ec0ebf 100644
--- a/Functions/Zftp/zfdir
+++ b/Functions/Zftp/zfdir
@@ -62,7 +62,7 @@ for (( i = 1; i <= $#argv; i++ )); do
   fi
 done
 
-if [[ $# -eq 0 ]]; then
+if [[ $# -eq 0 && $redir -ne 1 ]]; then
   # Cache it in the current directory file.  This means that repeated
   # calls to zfdir with no arguments always use a cached file.
   if [[ -z $curdir ]]; then
@@ -79,11 +79,12 @@ else
   fi
   file=$otherdir
   newargs="$*"
-  if [[ -f $file && $redir != 1 && $force -ne 1 ]]; then
+  if [[ -f $file && -n $newargs && $force -ne 1 ]]; then
     # Don't use the cached file if the arguments changed.
+    # Even in zfdir -r new_args ...
     [[ $newargs = $zfconfig[otherargs_$ZFTP_SESSION] ]] || rm -f $file
   fi
-  zfconfig[otherargs_$ZFTP_SESSION]=$newargs
+  [[ -n $newargs ]] && zfconfig[otherargs_$ZFTP_SESSION]=$newargs
 fi
 
 if [[ $force -eq 1 ]]; then
-- 
1.9.3


                 reply	other threads:[~2015-05-27  6:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150527062213.GA28760@localhost.localdomain \
    --to=hanpt@linux.vnet.ibm.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).