summaryrefslogtreecommitdiff
path: root/functions/_mosh
diff options
context:
space:
mode:
authorTill Höppner2017-05-15 14:33:13 +0200
committerTill Höppner2017-05-15 14:33:13 +0200
commitd027cc4db3c84e0333b1b3136484b412a2f86a67 (patch)
treee9a11a3c74ebb282084cbe98ff8206b4e264cbc3 /functions/_mosh
parent25cd8380f802b069f95d9514563aa2a083176925 (diff)
downloadzsh-d027cc4db3c84e0333b1b3136484b412a2f86a67.tar.gz
zsh-d027cc4db3c84e0333b1b3136484b412a2f86a67.tar.xz
zsh-d027cc4db3c84e0333b1b3136484b412a2f86a67.zip
Fix ssh/mosh completions to honor ~/.ssh/config during listing
Diffstat (limited to 'functions/_mosh')
-rw-r--r--functions/_mosh29
1 files changed, 29 insertions, 0 deletions
diff --git a/functions/_mosh b/functions/_mosh
new file mode 100644
index 0000000..b8e7e49
--- /dev/null
+++ b/functions/_mosh
@@ -0,0 +1,29 @@
+#compdef mosh
+
+# load ssh completions to use _ssh_hosts
+_ssh
+
+local curcontext="$curcontext" state line
+local -a _comp_priv_prefix
+
+_arguments -C \
+ '(-)--help[display help information]' \
+ '(-)--version[display version information]' \
+ "--no-init[don't set terminal init string]" \
+ '--ssh=[specify ssh command to setup session]:ssh command:_normal' \
+ '--port=[specify server-side port range]:port:_sequence -n 2 -s \: _ports' \
+ '(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \
+ '(--predict -n)-a[synonym for --predict=always]' \
+ '(--predict -a)-n[synonym for --predict=never]' \
+ '--server[specify command to run server helper]:remote file:_files' \
+ '--client[specify command to run client helper]:_command_names -e' \
+ '1:remote host name:->userhost' \
+ '*:::args:_normal' && return
+
+case $state in
+ userhost)
+ _ssh_hosts || _user_at_host && return
+ ;;
+esac
+
+return 1