* [PATCH] sshfs -o options completion
@ 2015-08-11 22:02 Daniel Shahaf
2015-08-13 23:57 ` Daniel Shahaf
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2015-08-11 22:02 UTC (permalink / raw)
To: zsh-workers
The "action" part of the -o spec didn't escape colons.
diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs
index c6a8e10..b562ce2 100644
--- a/Completion/Linux/Command/_sshfs
+++ b/Completion/Linux/Command/_sshfs
@@ -1,10 +1,13 @@
#compdef sshfs
+local context state state_descr line
+typeset -A opt_args
+
_arguments \
'-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]' \
@@ -12,3 +15,21 @@ _arguments \
'-h[help]' \
':remote directory:_user_at_host -S:' \
':mountpoint:_files -/'
+
+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
+fi
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sshfs -o options completion
2015-08-11 22:02 [PATCH] sshfs -o options completion Daniel Shahaf
@ 2015-08-13 23:57 ` Daniel Shahaf
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2015-08-13 23:57 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-13 23:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-11 22:02 [PATCH] sshfs -o options completion Daniel Shahaf
2015-08-13 23:57 ` Daniel Shahaf
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).