From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 705 invoked by alias); 13 Aug 2015 23:57:14 -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: 36158 Received: (qmail 2670 invoked from network); 13 Aug 2015 23:57:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=9virAfmcN41zRmNc92XUxMCUdoo=; b=m+tIYC m5nmIRzW/05PrNwURkRCILH8KwEzsXZ20dogO4knG08PeY0+oll5PdHAxvbX3WYR 0oMUW+pDsZyJFIuWypAcDZBvpIirdcfIwO+5tyHtW0CmxfLFtdjzbUltv8Hws1Et CoYsZfbSUmrHC87TohEHj0CTzve6xx3pOVoGw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=9virAfmcN41zRmNc92XUxMCUdoo=; b=A86ri QJi4rxGYIaHdCoUwB1t3vBxqVro2UMfdVAQkQCDO3HIHeP2KLQYknLUChPamLaSN K4lpq7y/r7rBYKQxSUvQxdT91nPEGXQ0uwyGSO26Qa3YUEuyWYCIB7wIUHGXDymy AxJfX+a86hcFitMUS9z+9640uuJlOFp5TGjDKQ= X-Sasl-enc: IucJN40WKNvHzA/TsfgQvT09dloFmXrQt/KcL9vUQaw6 1439510230 Date: Thu, 13 Aug 2015 23:57:07 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH] sshfs -o options completion Message-ID: <20150813235707.GL1998@tarsus.local2> References: <20150811220231.GC1859@tarsus.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150811220231.GC1859@tarsus.local2> User-Agent: Mutt/1.5.21 (2010-09-15) Daniel Shahaf wrote on Tue, Aug 11, 2015 at 22:02:31 +0000: > The "action" part of the -o spec didn't escape colons. Fixed to localize $curcontext and set $ret correctly (thanks to Oliver for the review): diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs index c6a8e10..e6d1370 100644 --- a/Completion/Linux/Command/_sshfs +++ b/Completion/Linux/Command/_sshfs @@ -1,14 +1,39 @@ #compdef sshfs -_arguments \ +local context state state_descr line +typeset -A opt_args +local curcontext="$curcontext" +integer ret=1 + +_arguments -C \ '-V[version]' \ '-p:tcp port:' \ '-C[compression]' \ - '-o:options:_values -s , "sshfs or fuse or mount options" reconnect sshfs_sync no_readahead sshfs_debug cache=:cache\ setting:(yes no) cache_timeout=:seconds: cache_stat_timeout=:seconds: cache_dir_timeout=:seconds: cache_link_timeout=:seconds: ssh_command=:ssh\ command:_command_names directport=:port: SSHOPT=:ssh\ option: default_permissions allow_other allow_root kernel_cache large_read direct_io max_read=:size: hard_remove debug fs_name=:name: use_ino readdir_ino' \ + '-o:options:->options' \ '-d[debug]' \ '-f[foreground]' \ '-s[disable multithreaded operation]' \ '-r[mount read-only]' \ '-h[help]' \ ':remote directory:_user_at_host -S:' \ - ':mountpoint:_files -/' + ':mountpoint:_files -/' && ret=0 + +if [[ $state == options ]]; then + _values -s , "sshfs or fuse or mount options" \ + reconnect sshfs_sync no_readahead sshfs_debug \ + 'cache=:cache setting:(yes no)' \ + cache_timeout=:seconds: \ + cache_stat_timeout=:seconds: \ + cache_dir_timeout=:seconds: \ + cache_link_timeout=:seconds: \ + 'ssh_command=:ssh command:_command_names' \ + directport=:port: \ + 'SSHOPT=:ssh option:' \ + default_permissions allow_other allow_root kernel_cache large_read direct_io \ + max_read=:size: \ + hard_remove debug \ + fs_name=:name: \ + use_ino readdir_ino && ret=0 +fi + +return ret