#compdef mktap
_mktap_subcmds=(
"ftp:An FTP server."
"telnet:A simple, telnet-based remote debugging service."
"socks:A SOCKSv4 proxy service."
"manhole:An interactive remote debugger service."
"portforward:A simple port-forwarder."
"web:A general-purpose web server which can serve from a filesystem or application resource."
"inetd:An inetd(8) replacement."
"news:A news server."
"words:A modern words server"
"toc:An AIM TOC service."
"dns:A domain name server."
"mail:An email service"
"manhole:An interactive remote debugger service accessible via telnet and ssh and providing syntax coloring and basic line editing functionality."
"conch:A Conch SSH service."
)

_arguments -s -A "-*" \
'*::subcmd:->subcmd' \
'(--uid)-u[The uid to run as.]:uid to run as:_files' \
'(-u)--uid=[The uid to run as.]:uid to run as:_files' \
'(--appname)-n[The process name to use for this application.]:appname:_files' \
'(-n)--appname=[The process name to use for this application.]:appname:_files' \
"(--encrypted)-e[Encrypt file before writing (will make the extension of the resultant file begin with 'e')]" \
"(-e)--encrypted[Encrypt file before writing (will make the extension of the resultant file begin with 'e')]" \
'(--gid)-g[The gid to run as.]:gid to run as:_files' \
'(-g)--gid=[The gid to run as.]:gid to run as:_files' \
'--version[version]' \
'(--debug)-d[Show debug information for plugin loading]' \
'(-d)--debug[Show debug information for plugin loading]' \
'(--progress)-p[Show progress information for plugin loading]' \
'(-p)--progress[Show progress information for plugin loading]' \
"(--type)-t[The output format to use; this can be 'pickle', 'xml', or 'source'.]:output format:(pickle xml source)" \
"(-t)--type=[The output format to use; this can be 'pickle', 'xml', or 'source'.]:output format:(pickle xml source)" \
'(--append)-a[An existing .tap file to append the plugin to, rather than creating a new one.]:tap file to append to:_files -g "*.tap"' \
'(-a)--append=[An existing .tap file to append the plugin to, rather than creating a new one.]:tap file to append to:_files -g "*.tap"' \
'(--help)-h[Display this message]' \
'(-h)--help[Display this message]' \
&& return 0
if (( CURRENT == 1 )); then
  _describe "tap to build" _mktap_subcmds && ret=0
fi
(( ret )) || return 0

service="$words[1]"

case $service in
ftp)
_arguments -s -A "-*" \
'--password-file=[username:password-style credentials database]:password-file:_files' \
'--help[Display this help and exit.]' \
'--userAnonymous=[Name of the anonymous user.]:userAnonymous:_files' \
'--version[version]' \
'(--root)-r[define the root of the ftp-site.]:root:_files' \
'(-r)--root=[define the root of the ftp-site.]:root:_files' \
'(--port)-p[set the port number]:port:_files' \
'(-p)--port=[set the port number]:port:_files' \
&& return 0
;;
telnet)
_arguments -s -A "-*" \
'(--username)-u[set the login username]:username:_users' \
'(-u)--username=[set the login username]:username:_users' \
'(--password)-w[set the password]:password:_files' \
'(-w)--password=[set the password]:password:_files' \
'(--port)-p[port to listen on]:port:_files' \
'(-p)--port=[port to listen on]:port:_files' \
'--version[version]' \
'--help[Display this help and exit.]' \
&& return 0
;;
socks)
_arguments -s -A "-*" \
'(--interface)-i[local interface to which we listen]:interface:_files' \
'(-i)--interface=[local interface to which we listen]:interface:_files' \
'--version[version]' \
'--help[Display this help and exit.]' \
'(--port)-p[Port on which to listen]:port:_files' \
'(-p)--port=[Port on which to listen]:port:_files' \
"(--log)-l[file to log connection data to]:log:_files -g '*.log'" \
"(-l)--log=[file to log connection data to]:log:_files -g '*.log'" \
&& return 0
;;
manhole)
_arguments -s -A "-*" \
'--help[Display this help and exit.]' \
'--version[version]' \
'(--user)-u[Name of user to allow to log in]:user:_users' \
'(-u)--user=[Name of user to allow to log in]:user:_users' \
"(--password)-w[Required.  '-' will prompt or read a password from stdin.]:password:_files" \
"(-w)--password=[Required.  '-' will prompt or read a password from stdin.]:password:_files" \
'(--port)-p[Port to listen on]:port:_files' \
'(-p)--port=[Port to listen on]:port:_files' \
'(--tracebacks)-T[Allow tracebacks to be sent over the network]' \
'(-T)--tracebacks[Allow tracebacks to be sent over the network]' \
&& return 0
;;
portforward)
_arguments -s -A "-*" \
'(--host)-h[Set the host.]:host:_hosts' \
'(-h)--host=[Set the host.]:host:_hosts' \
'--version[version]' \
'--help[Display this help and exit.]' \
'(--port)-p[Set the port number.]:port:_files' \
'(-p)--port=[Set the port number.]:port:_files' \
'(--dest_port)-d[Set the destination port.]:dest_port:_files' \
'(-d)--dest_port=[Set the destination port.]:dest_port:_files' \
&& return 0
;;
web)
_arguments -s -A "-*" \
'--help[Display this help and exit.]' \
'--resource-script=[An .rpy file to be used as the root resource of the webserver.]:resource-script:_files' \
'(--static)-s[Same as --path, this is deprecated and will be removed in a]:static:_files' \
'(-s)--static=[Same as --path, this is deprecated and will be removed in a]:static:_files' \
'(--user)-u[Makes a server with ~/public_html and ~/.twistd-web-pb support for]' \
'(-u)--user[Makes a server with ~/public_html and ~/.twistd-web-pb support for]' \
'--flashconduit=[Start a flashconduit on the specified port.]:flashconduit:_files' \
'--path=[<path> is either a specific file or a directory to]:path:_files' \
"(--logfile)-l[Path to web CLF (Combined Log Format) log file.]:logfile:_files -g '*.log'" \
"(-l)--logfile=[Path to web CLF (Combined Log Format) log file.]:logfile:_files -g '*.log'" \
'--class=[Create a Resource subclass with a zero-argument constructor.]:class:_files' \
'--ignore-ext=[Specify an extension to ignore.  These will be processed in order.]:ignore-ext:_files' \
"(--privkey)-k[SSL certificate to use for HTTPS.]:privkey:_files -g '*.pem'" \
"(-k)--privkey=[SSL certificate to use for HTTPS.]:privkey:_files -g '*.pem'" \
"--allow-ignore-ext[Specify whether or not a request for 'foo' should return 'foo.ext']" \
'(--index)-i[Add the name of a file used to check for directory indexes.]:index:_files' \
'(-i)--index=[Add the name of a file used to check for directory indexes.]:index:_files' \
"(--certificate)-c[SSL certificate to use for HTTPS. ]:certificate:_files -g '*.pem'" \
"(-c)--certificate=[SSL certificate to use for HTTPS. ]:certificate:_files -g '*.pem'" \
'(--notracebacks)-n[Display tracebacks in broken web pages. Displaying tracebacks to users may be security risk!]' \
'(-n)--notracebacks[Display tracebacks in broken web pages. Displaying tracebacks to users may be security risk!]' \
'(--mime-type)-m[Specify the default mime-type for static files.]:mime-type:_files' \
'(-m)--mime-type=[Specify the default mime-type for static files.]:mime-type:_files' \
'(--port)-p[Port to start the server on.]:port:_files' \
'(-p)--port=[Port to start the server on.]:port:_files' \
'--personal[Instead of generating a webserver, generate a ResourcePublisher which listens on ~/.twistd-web-pb]' \
'--version[version]' \
'--https=[Port to listen on for Secure HTTP.]:https:_files' \
"--processor=[\`ext=class' where \`class' is added as a Processor for files ending]:processor:_files" \
&& return 0
;;
inetd)
_arguments -s -A "-*" \
"(--nointernal)-i[Don't run internal services]" \
"(-i)--nointernal[Don't run internal services]" \
'(--rpc)-r[RPC procedure table file]:rpc:_files' \
'(-r)--rpc=[RPC procedure table file]:rpc:_files' \
'--version[version]' \
'--help[Display this help and exit.]' \
"(--file)-f[Service configuration file]:file:_files -g '*.conf'" \
"(-f)--file=[Service configuration file]:file:_files -g '*.conf'" \
&& return 0
;;
news)
_arguments -s -A "-*" \
'--group=[The name of a newsgroup to carry.]:group:_files' \
'--help[Display this help and exit.]' \
'--server=[The address of a Usenet server to pass messages to and receive messages from.]:server:_files' \
'--moderator=[The email of the moderator for the most recently passed group.]:moderator:_files' \
'(--datadir)-d[Root data storage path]:datadir:_dirs' \
'(-d)--datadir=[Root data storage path]:datadir:_dirs' \
'(--mailhost)-m[Host of SMTP server to use]:mailhost:_hosts' \
'(-m)--mailhost=[Host of SMTP server to use]:mailhost:_hosts' \
'--version[version]' \
'(--interface)-i[Interface to which to bind]:interface:_files' \
'(-i)--interface=[Interface to which to bind]:interface:_files' \
'(--port)-p[Listen port]:port:_files' \
'(-p)--port=[Listen port]:port:_files' \
'--subscription=[A newsgroup to list as a recommended subscription.]:subscription:_files' \
&& return 0
;;
words)
_arguments -s -A "-*" \
'--group=[Specify a group which should exist]:group:_files' \
'--help[Display this help and exit.]' \
'--passwd=[Name of a passwd-style password file. (REQUIRED)]:passwd:_files' \
'--hostname=[Name of this server; purely an informative]:hostname:_files' \
'--irc-port=[strports description of the port to bind for the  irc server]:irc-port:_files' \
'--pb-port=[strports description of the port to bind for the  pb server]:pb-port:_files' \
'--version[version]' \
&& return 0
;;
toc)
_arguments -s -A "-*" \
'--version[version]' \
'(--port)-p[port]:port:_files' \
'(-p)--port=[port]:port:_files' \
'--help[Display this help and exit.]' \
&& return 0
;;
dns)
_arguments -s -A "-*" \
'(--verbose)-v[Log verbosely]' \
'(-v)--verbose[Log verbosely]' \
'--resolv-conf=[Override location of resolv.conf (implies --recursive)]:resolv-conf:_files' \
'(--interface)-i[The interface to which to bind]:interface:_files' \
'(-i)--interface=[The interface to which to bind]:interface:_files' \
'--pyzone=[Specify the filename of a Python syntax zone definition]:pyzone:_files' \
'--secondary=[Act as secondary for the specified domain, performing]:secondary:_files' \
'(--recursive)-r[Perform recursive lookups]' \
'(-r)--recursive[Perform recursive lookups]' \
'(--cache)-c[Enable record caching]' \
'(-c)--cache[Enable record caching]' \
'--help[Display this help and exit.]' \
'(--port)-p[The port on which to listen]:port:_files' \
'(-p)--port=[The port on which to listen]:port:_files' \
'--version[version]' \
'--bindzone=[Specify the filename of a BIND9 syntax zone definition]:bindzone:_files' \
'--hosts-file=[Perform lookups with a hosts file]:hosts-file:_files' \
&& return 0
;;
mail)
_arguments -s -A "-*" \
'--help[Display this help and exit.]' \
"(--relay)-R[Relay messages according to their envelope 'To', using the givenpath as a queue directory.]:relay:_files" \
"(-R)--relay=[Relay messages according to their envelope 'To', using the givenpath as a queue directory.]:relay:_files" \
'(--pop3s)-S[Port to start the POP3-over-SSL server on (0 to disable).]:pop3s:_files' \
'(-S)--pop3s=[Port to start the POP3-over-SSL server on (0 to disable).]:pop3s:_files' \
'(--smtp)-s[Port to start the SMTP server on (0 to disable).]:smtp:_files' \
'(-s)--smtp=[Port to start the SMTP server on (0 to disable).]:smtp:_files' \
'(--maildirdbmdomain)-d[generate an SMTP/POP3 virtual domain which saves to "path"]:maildirdbmdomain:_files' \
'(-d)--maildirdbmdomain=[generate an SMTP/POP3 virtual domain which saves to "path"]:maildirdbmdomain:_files' \
'(--pop3)-p[Port to start the POP3 server on (0 to disable).]:pop3:_files' \
'(-p)--pop3=[Port to start the POP3 server on (0 to disable).]:pop3:_files' \
'(--user)-u[add a user/password to the last specified domains]:user:_files' \
'(-u)--user=[add a user/password to the last specified domains]:user:_files' \
'(--bounce-to-postmaster)-b[undelivered mails are sent to the postmaster]' \
'(-b)--bounce-to-postmaster[undelivered mails are sent to the postmaster]' \
'(--aliases)-A[Specify an aliases(5) file to use for this domain]:aliases:_files' \
'(-A)--aliases=[Specify an aliases(5) file to use for this domain]:aliases:_files' \
'(--certificate)-c[Certificate file to use for SSL connections]:certificate:_files' \
'(-c)--certificate=[Certificate file to use for SSL connections]:certificate:_files' \
'(--default)-D[Make the most recently specified domain the default domain.]' \
'(-D)--default[Make the most recently specified domain the default domain.]' \
'(--hostname)-H[The hostname by which to identify this server.]:hostname:_hosts' \
'(-H)--hostname=[The hostname by which to identify this server.]:hostname:_hosts' \
'--disable-anonymous[Disallow non-authenticated SMTP connections]' \
'(--esmtp)-E[Use RFC 1425/1869 SMTP extensions]' \
'(-E)--esmtp[Use RFC 1425/1869 SMTP extensions]' \
'--version[version]' \
'(--passwordfile)-P[Specify a file containing username:password login info for authenticated ESMTP connections.]:passwordfile:_files' \
'(-P)--passwordfile=[Specify a file containing username:password login info for authenticated ESMTP connections.]:passwordfile:_files' \
&& return 0
;;
manhole)
_arguments -s -A "-*" \
'--help[Display this help and exit.]' \
'(--passwd)-p[name of a passwd(5)-format username/password file]:passwd:_files' \
'(-p)--passwd=[name of a passwd(5)-format username/password file]:passwd:_files' \
'--version[version]' \
'--user=[user]:user:_files' \
'(--sshPort)-s[strports description of the address on which to listen for ssh connections]:sshPort:_files' \
'(-s)--sshPort=[strports description of the address on which to listen for ssh connections]:sshPort:_files' \
'(--telnetPort)-t[strports description of the address on which to listen for telnet connections]:telnetPort:_files' \
'(-t)--telnetPort=[strports description of the address on which to listen for telnet connections]:telnetPort:_files' \
&& return 0
;;
conch)
_arguments -s -A "-*" \
'--moduli=[directory to look for moduli in (if different from --data)]:moduli:_dirs' \
'--help[Display this help and exit.]' \
'--version[version]' \
'(--interface)-i[local interface to which we listen]:interface:_files' \
'(-i)--interface=[local interface to which we listen]:interface:_files' \
'(--data)-d[directory to look for host keys in]:data:_dirs' \
'(-d)--data=[directory to look for host keys in]:data:_dirs' \
'(--port)-p[Port on which to listen]:port:_files' \
'(-p)--port=[Port on which to listen]:port:_files' \
&& return 0
;;
*) _message "don't know how to complete $service";;
esac