From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18658 invoked by alias); 7 Sep 2016 00:20:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39200 Received: (qmail 13907 invoked from network); 7 Sep 2016 00:20:02 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.53):SA:0(1.1/5.0):. Processed in 0.830464 secs); 07 Sep 2016 00:20:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=DATE_IN_PAST_06_12, HTML_MESSAGE,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: y@hnw.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at hnw.jp does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hnw-jp.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=BYmZa1xuAXR+TnUNMxDj58kjOA5hHZ535DcMvlZXwqY=; b=QUPzJHLSaf6m4Cc0opvmv6paKIwrXhR9Aa/Ph0Ac7fBTJG6u6hmoOTQ+uXnL934gYQ VxU8Nea7lT+tA7rskeQYsAyjEyGqhvYNtfI+nsbTL6qSwj1NtgW5HZCj3Q/2TYMcQuY+ L9kffRXd4aoPr+ZitgE/9ztI785jUT5X8VFgveCShHRdMNrvs0vtx8DWILX18/GGOIrD 6mEtqCOOYoesthb25hloTbhQ3NiIaeJlWM99Mqw9N07W9w8MqVPixbHLcJFmhlUXRawE gXQ5XroFagEpJDU5gpgyLdcD4i/tbdB54vOurHKIYEib7O9Lt23D8Qvqn3gHHaJyMUhX g7gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=BYmZa1xuAXR+TnUNMxDj58kjOA5hHZ535DcMvlZXwqY=; b=Xm2IEMWfinV1eLHij4lu2TTneQodRrqU28g0v2Z9ZtDF7DP+RrnAfxFrLOB6OiWjVH GjblotVe2/WTBJZyleTDRt9yjsKoC5HsRNTHMoostaj6UbHjsP6HrfjYuPjS16VlVjx8 GeTMHUkSyit2Cm6Jo9es6D0XfHt34h8j/9JP/LVtx+dAYn+cxDTyW533iL5qFl/1oWWR 7VPsxf9ixvYkGgiMGW67tMwpA1jWEdFyj9hBb4SwvL2rvZSY55lMNLv3ylzzq1ClvGFE i0szbHcnRr+H2HCyGUj1KGQGmN5QoBIQgfeoBTWGYSDc6G00leqGrBMhpyrXIlIonuJE 3rCA== X-Gm-Message-State: AE9vXwPpiKce9Eck/soULtpkRPyAcLwVAmwR14WuEdcavZptPhO+Ndh7lqYO31GHGHwhZVxiFGKlOigMXVIDMg== X-Received: by 10.31.205.66 with SMTP id d63mr23031119vkg.80.1473182809087; Tue, 06 Sep 2016 10:26:49 -0700 (PDT) MIME-Version: 1.0 X-Originating-IP: [180.235.11.238] In-Reply-To: <95820.1473177359@hydra.kiddle.eu> References: <95820.1473177359@hydra.kiddle.eu> From: Yoshio Hanawa Date: Wed, 7 Sep 2016 02:26:28 +0900 Message-ID: Subject: Re: Unexpected behavior for completion funcion _remote_files() To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=001a114dd88c067cff053bda1a3b --001a114dd88c067cff053bda1a3b Content-Type: text/plain; charset=UTF-8 Hi. > Ideally, any extra options from before -- should be passed on. I understood your intention well. > Could you perhaps try the following? Your patch works fine with 'docker exec ...'. I also check '_remote_files -x foobar -- docker exec ..', it works as expected. Thank you so much. 2016-09-07 0:55 GMT+09:00 Oliver Kiddle : > Yoshio Hanawa wrote: > > When I tried Zsh completion funcion _remote_files with 'docker exec > ...', I > > found the command line options for _remote_files (in this case, 'exec > ...') > > are passed directly to compadd. I think it's unexpected behavior. > > Yes, _remote_files shouldn't pass options that come after -- to compadd. > Thanks for the report. > > > "$@" in compadd arguments seems to be unnecessary, so should simply be > > removed. > > Ideally, any extra options from before -- should be passed on. > At the very least it should allow for them being there - currently, just > using > _wanted with _remote_files fails. Using this would allow docker > completion to override the description given with the files if 'remote > file' is not applicable. > > > The following patch works fine on my environment. > > Could you perhaps try the following? I don't have docker so have only > tested this with ssh. > > Thanks > > Oliver > > diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_ > remote_files > index db33164..54bd438 100644 > --- a/Completion/Unix/Type/_remote_files > +++ b/Completion/Unix/Type/_remote_files > @@ -28,16 +28,19 @@ > > > # There should be coloring based on all the different ls -F classifiers. > -local expl rempat remfiles remdispf remdispd args cmd cmd_args suf ret=1 > +local expl rempat remfiles remdispf remdispd args cmd suf ret=1 > +local -a args cmd_args > local glob host > > if zstyle -T ":completion:${curcontext}:files" remote-access; then > > # Parse options to _remote_files. Stops at the first "--". > zparseopts -D -E -a args / g:=glob h:=host > - shift > (( $#host)) && shift host || host="${IPREFIX%:}" > > + args=( ${argv[1,(I)--]} ) > + shift ${#args} > + args[-1]=() > # Command to run on the remote system. > cmd="$1" > shift > @@ -45,9 +48,9 @@ if zstyle -T ":completion:${curcontext}:files" > remote-access; then > # Handle arguments to ssh. > if [[ $cmd == ssh ]]; then > zparseopts -D -E -a cmd_args p: 1 2 4 6 F: > - cmd_args="-o BatchMode=yes $cmd_args -a -x" > + cmd_args=( -o BatchMode=yes "$cmd_args[@]" -a -x ) > else > - cmd_args="$@" > + cmd_args=( "$@" ) > fi > > if [[ -z $QIPREFIX ]] > @@ -74,8 +77,8 @@ if zstyle -T ":completion:${curcontext}:files" > remote-access; then > while _tags; do > while _next_label files expl ${suf:-remote directory}; do > [[ -n $suf ]] && > - compadd "$@" "$expl[@]" -d remdispf ${(q)remdispf%[*=|]} && > ret=0 > - compadd ${suf:+-S/} -r "/ \t\n\-" "$@" "$expl[@]" -d remdispd \ > + compadd "$args[@]" "$expl[@]" -d remdispf ${(q)remdispf%[*=|]} > && ret=0 > + compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd > \ > ${(q)remdispd%/} && ret=0 > done > (( ret )) || return 0 > --001a114dd88c067cff053bda1a3b--