about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2002-03-10 04:20:55 +0000
committerClint Adams <clint@users.sourceforge.net>2002-03-10 04:20:55 +0000
commit968d8e5e2c0a640358d39fb36b89ed1d60f2204e (patch)
tree9d6eb2ffda3bf5060a0af6cb0808f87ff7edcbd4 /Completion/Unix/Command
parentcae16f27ecf8caba054d97074a35148a2c74f826 (diff)
downloadzsh-968d8e5e2c0a640358d39fb36b89ed1d60f2204e.tar.gz
zsh-968d8e5e2c0a640358d39fb36b89ed1d60f2204e.tar.xz
zsh-968d8e5e2c0a640358d39fb36b89ed1d60f2204e.zip
16789: completion for netcat
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_netcat34
1 files changed, 34 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_netcat b/Completion/Unix/Command/_netcat
new file mode 100644
index 000000000..d5e854e12
--- /dev/null
+++ b/Completion/Unix/Command/_netcat
@@ -0,0 +1,34 @@
+#compdef nc netcat
+
+local curcontext="$curcontext" state line expl
+typeset -A opt_args
+
+if (( ! $+_nc_args )); then
+  local help="$(_call_program options nc -h < /dev/null 2>&1)"
+  local -A optionmap
+  optionmap=(
+    '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e'
+     '*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts'
+     '*-G num*' '-G[source-routing pointer: 4, 8, 12]'
+     '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:secs:'
+     '*-l*' '-l[listen mode]'
+     '*-n*' '-n[numeric-only IP addresses, no DNS]'
+     '*-o file*' '-o+[hex dump of traffic]:file:_files'
+     '*-p port*' '-p+[local port number]:port:_ports'
+     '*-r*' '-r[randomize local and remote ports]'
+     '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:secs:'
+     '*-t*' '-t[answer TELNET negotiation]'
+     '*-u*' '-u[UDP mode]'
+     '*-v*' '-v[verbose]'
+     '*-w secs*' '-w+[timeout for connects and final net reads]:secs:'
+     '*-z*' '-z[zero-I/O mode]'
+     '*-x*' '-x'
+     '*-b*' '-b[allow broadcasts]'
+  )
+  _nc_args=($optionmap[(K)"$help"])
+fi
+
+_arguments -C -s \
+  "$_nc_args[@]" \
+  ':host:_hosts' \
+  ':port:_ports' && return 0