_mktap   [plain text]


#compdef mktap

# if the available subcmds aren't cached in
# this global var then we create it
if [[ -z $_mktap_subcmds ]]; then
  _mktap_subcmds=(
    "conch:A Conch SSH service"
    "dns:A Domain Name Server"
    "ftp:An FTP server"
    "inetd:An inetd(8) replacement"
    "mail:An email service"
    "manhole:An interactive remote debugger service"
    "news:News Server"
    "portforward:A simple port-forwarder"
    "socks:A SOCKSv4 proxy service"
    "telnet:A simple, telnet-based remote debugging service"
    "toc:An AIM TOC service"
    "web:A general-purpose web server"
    "words:A chat service"
    )
  local third_party_modules available_modules py_code
  typeset -A third_party_modules
  third_party_modules=(
    "cvstoys.fresher"       "cvsweb:CVS commit news on RSS and HTML"
    "cvstoys.clients.words" "cvswords:CVS commit notification over chat services"
    "cvstoys.clients.web"   "freshcvs:CVS commit tracking and notification"
    )
  py_code="
moduleNames = '${(k)third_party_modules}'
import sys, os
paths = filter(os.path.isdir, sys.path)
exists = os.path.exists
def isModuleOnDisk(modName):
    modName = modName.replace('.', '/')
    for p in paths:
        for ext in ('.py', '.pyc', '.pyo'):
            if exists('%s/%s%s' % (p, modName, ext)):
                return True
    return False
print ' '.join(filter(isModuleOnDisk, moduleNames.split()))
"
  available_modules=($(echo $py_code | python))
        
  for module in $available_modules; do
    # append the spec's for the 3rd-party modules we found
    _mktap_subcmds[${#_mktap_subcmds}+1]=$third_party_modules[$module]
  done
fi

_arguments -C -S \
  '(--encrypted)-e[Encrypt file before writing]' \
  '(-e)--encrypted[Encrypt file before writing]' \
  '(--debug)-d[Show debug information for plugin loading]' \
  '(-d)--debug[Show debug information for plugin loading]' \
  '(--help)-h[Display verbose mktap help]' \
  '(-h)--help[Display verbose mktap help]' \
  '(--uid)-u[The uid to run as (default 1000)]:uid to run as: ' \
  '(-u)--uid=[The uid to run as (default 1000)]:uid to run as: ' \
  '(--gid)-g[The gid to run as (default 1000)]:gid to run as: ' \
  '(-g)--gid=[The gid to run as (default 1000)]:gid to run as: ' \
  '(--append)-a[An existing .tap file to append the plugin to]:.tap file to append to:_files -g "*.tap"' \
  '(-a)--append=[An existing .tap file to append the plugin to]:.tap file to append to:_files -g "*.tap"' \
  '(--type)-t[The output format to use (default pickle)]:output format:(pickle xml source)' \
  '(-t)--type=[The output format to use (default pickle)]:output format:(pickle xml source)' \
  '(--appname)-n[The process name to use for this application]:process name: ' \
  '(-n)--appname=[The process name to use for this application]:process name: ' \
  '--version[Print version information and exit]' \
  '*::sub command:->subcmd' \
  && return 0

if (( CURRENT == 1 )); then
  _describe "tap to build" _mktap_subcmds && ret=0
fi
(( ret )) || return 0

service="$words[1]"

case $service in
  conch)
    _arguments \
      '(--interface)-i[Address of interface to bind to]:net interface address: ' \
      '(-i)--interface=[Address of interface to bind to]:net interface address: ' \
      '(--port)-p[Listen port (default 5822)]:port: ' \
      '(-p)--port=[Listen port (default 5822)]:port: ' \
      '(--data)-d[Directory to look for host keys in (default /etc)]:directory host keys are in:_directories' \
      '(-d)--data=[Directory to look for host keys in (default /etc)]:directory host keys are in:_directories' \
      '--moduli=[Directory to look for moduli in (if different from --data)]:moduli directory:_directories' \
      '--help[Display verbose command help]'
  ;;
  dns)
    _arguments \
      '(--cache)-c[Enable record caching]' \
      '(-c)--cache[Enable record caching]' \
      '(--recursive)-r[Perform recursive lookups]' \
      '(-r)--recursive[Perform recursive lookups]' \
      '(--iterative)-I[Perform lookups using the root servers]' \
      '(-I)--iterative[Perform lookups using the root servers]' \
      '(--verbose)-v[Increment verbosity level]' \
      '(-v)--verbose[Increment verbosity level]' \
      '(--interface)-i[Address of interface to bind to]:net interface address: ' \
      '(-i)--interface=[Address of interface to bind to]:net interface address: ' \
      '(--port)-p[Listen port]:port: ' \
      '(-p)--port=[Listen port]:port: ' \
      '--resolv-conf=[Override location of resolv.conf]:your resolv.conf-like file:_files' \
      '--help[Display verbose command help]'
      '--secondary=[Act as secondary for the specified domain]:domain: ' \
      '--pyzone=[Filename of a Python syntax zone definition]:.py zone file:_files -g "*.py"' \
      '--bindzone=[Filename of a BIND9 syntax zone definition]:bind zone file:_files'
  ;;
  ftp)
    _arguments \
      '(--port)-p[Listen port]:port: ' \
      '(-p)--port=[Listen port]:port: ' \
      '(--root)-r[Root of the ftp-site (default /usr/local/ftp)]:root directory of the ftp-site:_directories' \
      '(-r)--root=[Root of the ftp-site (default /usr/local/ftp)]:root directory of the ftp-site:_directories' \
      '--userAnonymous=[Name of the anonymous user (default anonymous)]:name of anonymous user: ' \
      '--help[Display verbose command help]'
  ;;
  inetd)
    _arguments \
      "(--nointernal)-i[Don't run internal services]" \
      "(-i)--nointernal[Don't run internal services]" \
      '(--rpc)-r[RPC procedure table file (default /etc/rpc)]:RPC procedure table file:_files' \
      '(-r)--rpc=[RPC procedure table file (default /etc/rpc)]:RPC procedure table file:_files' \
      '(--file)-f[Service configuration file (default /etc/inetd.conf)]:service .conf file:_files -g "*.conf"' \
      '(-f)--file=[Service configuration file (default /etc/inetd.conf)]:service .conf file:_files -g "*.conf"' \
      '--help[Display verbose command help]'
  ;;
  mail)
    _arguments \
      '(--esmtp)-E[Use RFC 1425/1869 SMTP extensions]' \
      '(-E)--esmtp[Use RFC 1425/1869 SMTP extensions]' \
      '--disable-anonymous[Disallow non-authenticated SMTP connections]' \
      '(--pop3)-p[POP3 server port. 0 to disable (default 8110)]:pop3 port: ' \
      '(-p)--pop3=[POP3 server port. 0 to disable (default 8110)]:pop3 port: ' \
      '(--pop3s)-S[POP3-over-SSL server port. 0 to disable (default 0)]:pop3s port: ' \
      '(-S)--pop3s=[POP3-over-SSL server port. 0 to disable (default 0)]:pop3s port: ' \
      '(--smtp)-s[SMTP server port. 0 to disable (default 8025)]:smtp port: ' \
      '(-s)--smtp=[SMTP server port. 0 to disable (default 8025)]:smtp port: ' \
      '(--certificate)-c[Certificate file for SSL]:cert file for ssl:_files' \
      '(-c)--certificate=[Certificate file for SSL]:cert file for ssl:_files' \
      '(--relay)-R[Queue directory for relaying (see --help)]:relay queue dir:_directories' \
      '(-R)--relay=[Queue directory for relaying (see --help)]:relay queue dir:_directories' \
      '(--hostname)-H[Hostname of this server]:hostname: ' \
      '(-H)--hostname=[Hostname of this server]:hostname: ' \
      '(--default)-D[Make the most recently specified domain the default domain]' \
      '(-D)--default[Make the most recently specified domain the default domain]' \
      '(--maildirdbmdomain)-d[Generate an SMTP/POP3 virtual domain which saves to "path"]:path to save to:_directories' \
      '(-d)--maildirdbmdomain=[Generate an SMTP/POP3 virtual domain which saves to "path"]:path to save to:_directories' \
      '(--user)-u[Add a user/password to the last specified domains]:user/password: ' \
      '(-u)--user=[Add a user/password to the last specified domains]:user/password: ' \
      '(--passwordfile)-P[File containing username:password login info for authenticated ESMTP connections]:username\:password file:_files'
      '(-P)--passwordfile=[File containing username:password login info for authenticated ESMTP connections]:username\:password file:_files'
      '--bounce-to-postmaster[Undelivered mails are sent to the postmaster]' \
      '(--aliases)-A[Specify an aliases(5) file to use for this domain]:aliases(5) file:_files' \
      '(-A)--aliases=[Specify an aliases(5) file to use for this domain]:aliases(5) file:_files'
      '--help[Display verbose command help]'
  ;;
  manhole)
    _arguments \
      '(--tracebacks)-T[Allow tracebacks to be sent over the network]' \
      '(-T)--tracebacks[Allow tracebacks to be sent over the network]' \
      '(--user)-u[Name of user to allow to log in (default admin)]:username: ' \
      '(-u)--user=[Name of user to allow to log in (default admin)]:username: ' \
      '(--port)-p[Port to listen on (default 8787)]:port: ' \
      '(-p)--port=[Port to listen on (default 8787)]:port: ' \
      '(--password)-w[Required (- will prompt or read a password from stdin)]:password: ' \
      '(-w)--password=[Required (- will prompt or read a password from stdin)]:password: ' \
      '--help[Display verbose command help]'
  ;;
  news)
    _arguments \
      '(--port)-p[Listen port (default 119)]:port: ' \
      '(-p)--port=[Listen port (default 119)]:port: ' \
      '(--interface)-i[Address of interface to bind to]:net interface address: ' \
      '(-i)--interface=[Address of interface to bind to]:net interface address: ' \
      '(--datadir)-d[Root data storage path (default news.db)]:data storage path:_files' \
      '(-d)--datadir=[Root data storage path (default news.db)]:data storage path:_files' \
      '(--mailhost)-m[Host of SMTP server to use (default localhost)]:hostname: ' \
      '(-m)--mailhost=[Host of SMTP server to use (default localhost)]:hostname: ' \
      '--group=[Name of a newsgroup to carry]:newsgroup: ' \
      '--server=[Address of a Usenet server to send to and receive from]:Usenet server: ' \
      '--moderator=[Email of the moderator for the most recently specified group]:email address: ' \
      '--subscription=[Newsgroup to list as a recommended subscription]:newsgroup to list as recommended: ' \
      '--help[Display verbose command help]'
  ;;
  portforward)
    _arguments \
      '(--port)-p[Port number (default 6666)]:port: ' \
      '(-p)--port=[Port number (default 6666)]:port: ' \
      '(--host)-h[Host (default localhost)]:host: ' \
      '(-h)--host=[Host (default localhost)]:host: ' \
      '(--dest_port)-d[Destination port (default 6665)]:destination port: ' \
      '(-d)--dest_port=[Destination port (default 6665)]:destination port: ' \
      '--help[Display verbose command help]'
  ;;
  socks)
    _arguments \
      '(--interface)-i[Address of interface to bind to]:net interface address: ' \
      '(-i)--interface=[Address of interface to bind to]:net interface address: ' \
      '(--port)-p[Listen port (default 1080)]:port: ' \
      '(-p)--port=[Listen port (default 1080)]:port: ' \
      '(--log)-l[File to log connection data to]:.log file:_files -g "*.log"' \
      '(-l)--log=[File to log connection data to]:.log file:_files -g "*.log"' \
      '--help[Display verbose command help]'
  ;;
  telnet)
    _arguments \
      '(--username)-u[Login username (default admin)]:username: ' \
      '(-u)--username=[Login username (default admin)]:username: ' \
      '(--password)-w[Password (default changeme)]:password: ' \
      '(-w)--password=[Password (default changeme)]:password: ' \
      '(--port)-p[Listen port (default 4040)]:port: ' \
      '(-p)--port=[Listen port (default 4040)]:port: ' \
      '--help[Display verbose command help]'
  ;;
  toc)
    _arguments \
      '(--port)-p[Listen port (default 5190)]:port: ' \
      '(-p)--port=[Listen port (default 5190)]:port: ' \
      '--help[Display verbose command help]'
  ;;
  web)
    _arguments \
      '--personal[Make a ResourcePublisher listening on ~/.twistd-web-pb]' \
      '(--notracebacks)-n[Display tracebacks in broken web pages (could be a security risk!)]' \
      '(-n)--notracebacks[Display tracebacks in broken web pages (could be a security risk!)]' \
      '(--port)-p[Listen port (HTTP) (default 8080)]:port: ' \
      '(-p)--port=[Listen port (HTTP) (default 8080)]:port: ' \
      '(--logfile)-l[Path to web CLF (Combined Log Format) log file]:CLF .log file:_files -g "*.log"' \
      '(-l)--logfile=[Path to web CLF (Combined Log Format) log file]:CLF .log file:_files -g "*.log"' \
      '--https=[Listen port (HTTPS)]:https port: ' \
      '(--certificate)-c[SSL certificate to use for HTTPS (default server.pem)]:.pem certificate for https:_files -g "*.pem"' \
      '(-c)--certificate=[SSL certificate to use for HTTPS (default server.pem)]:.pem certificate for https:_files -g "*.pem"' \
      '(--privkey)-k[SSL certificate to use for HTTPS (default server.pem) ]:.pem certificate for https:_files -g "*.pem"' \
      '(-k)--privkey=[SSL certificate to use for HTTPS (default server.pem) ]:.pem certificate for https:_files -g "*.pem"' \
      '(--index)-i[Add the name of a directory index file (default index, index.html)]:directory index file:_files' \
      '(-i)--index=[Add the name of a directory index file (default index, index.html)]:directory index file:_files' \
      '(--static)-s[Same as --path, this is deprecated and will be removed in a future release]:same as --path [deprecated]:_directories' \
      '(-s)--static=[Same as --path, this is deprecated and will be removed in a future release]:same as --path [deprecated]:_directories' \
      '--class=[Create a Resource subclass with a zero-argument constructor]:Resource subclass with a zero-argument constructor: ' \
      '--flashconduit=[Start a flashconduit on the specified port]' \
      '--ignore-ext=[Specify an extension to ignore. These will be processed in order]' \
      '(--user)-u[Makes a server with ~/public_html and ~/.twistd-web-pb support for users]' \
      '(-u)--user[Makes a server with ~/public_html and ~/.twistd-web-pb support for users]' \
      "--allow-ignore-ext[Specify whether or not a request for 'foo' should return 'foo.ext']" \
      '--path=[A specific file or a directory to be set as the root of the web server]' \
      "--processor=['ext=class' where 'class' is added as a Processor for files ending with 'ext']" \
      '--mime-type=[Specify the default mime-type for static files]' \
      '--resource-script=[An .rpy file to be used as the root resource of the webserver]' \
      '--help[Display verbose command help]'
  ;;
  words)
    _arguments \
      '(--irc)-i[Port to run the IRC server on (default 6667)]:irc server port: ' \
      '(-i)--irc=[Port to run the IRC server on (default 6667)]:irc server port: ' \
      '(--irchost)-h[Host to bind IRC server to (no default)]:host to bind irc server to: ' \
      '(-h)--irchost=[Host to bind IRC server to (no default)]:host to bind irc server to: ' \
      '(--wordshost)-b[Host to bind Words service to (no default)]:host to bind Words service to: ' \
      '(-b)--wordshost=[Host to bind Words service to (no default)]:host to bind Words service to: ' \
      '(--webhost)-s[Host to bind web interface to (no default)]:host to bind web interface to: ' \
      '(-s)--webhost=[Host to bind web interface to (no default)]:host to bind web interface to: ' \
      '(--port)-p[Port to run the Words service on (default 8787)]:Words service port: ' \
      '(-p)--port=[Port to run the Words service on (default 8787)]:Words service port: ' \
      '(--web)-w[Port to run the web interface on (default 8080)]:web server port: ' \
      '(-w)--web=[Port to run the web interface on (default 8080)]:web server port: ' \
      "--bot=[Bot-plugin to load in the format 'plugin:nickname'. plugin types are: botbot]:bot-plugin to load in the format 'plugin:nickname': " \
      '--user=[user/password combo to add to the authorizer and chat service immediately]:user/password to add to the authorizer and chat service: ' \
      '--help[Display verbose command help]'
  ;;

# BEGIN third-party completions here
  
  cvsweb)
    _arguments \
      '--chost=[(default localhost)]:host: ' \
      '--cport=[(default 7878)]:port: ' \
      '--cuser=[(default web)]:username: ' \
      '--cpass=[(default notifiee)]:password: ' \
      '--cservice=[(default cvstoys.notify)]:service: ' \
      '--webport=[(default 8241)]:port: ' \
      '(--title)-t[(default Recent CVS Activity)]:title: ' \
      '(-t)--title=[(default Recent CVS Activity)]:title: ' \
      '(--description)-d[(no default)]:descr: ' \
      '(-d)--description=[(no default)]:descr: ' \
      '(--link)-l[(default http://twistedmatrix.com/)]:link: ' \
      '(-l)--link=[(default http://twistedmatrix.com/)]:link: ' \
      '--help[Display verbose command help]'
  ;;
  cvswords)
    _arguments \
      '(--config)-f[Configuration file]:config file:_files]' \
      '(-f)--config=[Configuration file]:config file:_files]' \
      '(--cvs-host)-H[FreshCVS host (default localhost)]:host: ' \
      '(-H)--cvs-host=[FreshCVS host (default localhost)]:host: ' \
      '(--cvs-port)-P[FreshCVS PB port (default 7878)]:port: ' \
      '(-P)--cvs-port=[FreshCVS PB port (default 7878)]:port: ' \
      '(--cvs-user)-U[FreshCVS username (default words)]:username: ' \
      '(-U)--cvs-user=[FreshCVS username (default words)]:username: ' \
      '(--cvs-pass)-W[FreshCVS password (default notifiee)]:password: ' \
      '(-W)--cvs-pass=[FreshCVS password (default notifiee)]:password: ' \
      '(--cvs-service)-S[FreshCVS service (default cvstoys.notify)]:service: ' \
      '(-S)--cvs-service=[FreshCVS service (default cvstoys.notify)]:service: ' \
      '--help[Display verbose command help]'
  ;;
  freshcvs)
    _arguments \
      '--manhole-port=[manhole port (default 8789)]:port: ' \
      '--pipe=[Unix socket to listen on]:unix socket to listen on: ' \
      '--manhole=[Password to the manhole (- will read from stdin or prompt)]:password: ' \
      '(--root)-r[Directory where the configuration file lives]:directory of config file:_directories' \
      '(-r)--root=[Directory where the configuration file lives]:directory of config file:_directories' \
      '--help[Display verbose command help]'
  ;;
  *) _message "don't know how to complete $service";;
esac