#compdef twistd

_arguments -S \
  '--savestats[Save the Stats object rather than the text output of the profiler]' \
  '(--encrypted)-e[The specified tap/aos/xml file is encrypted]' \
  '(-e)--encrypted[The specified tap/aos/xml file is encrypted]' \
  '--euid[Set only effective user-id rather than real user-id]' \
  '--report-profile=[E-mail address to use when reporting dynamic execution profiler stats]:email address: ' \
  '--version[Print version information and exit]' \
  '--help[Display more verbose help and exit]' \
  "--nothotshot[Don't use the 'hotshot' profiler even if it's available]" \
  "(--nodaemon)-n[Don't daemonize (stay in foreground)]" \
  "(-n)--nodaemon[Don't daemonize (stay in foreground)]" \
  '(--quiet)-q[No-op for backwards compatability]' \
  '(-q)--quiet[No-op for backwards compatability]' \
  '(--profile)-p[Run in profile mode, dumping results to specified file]:file to dump profile info to:_files' \
  '(-p)--profile=[Run in profile mode, dumping results to specified file]:file to dump profile info to:_files' \
  '(--debug)-b[Run the application in the Python Debugger (implies -nodaemon)]' \
  '(-b)--debug[Run the application in the Python Debugger (implies -nodaemon)]' \
  "(--no_save)-o[Don't save shutdown state]" \
  "(-o)--no_save[Don't save shutdown state]" \
  "--originalname[Don't change the running process name]" \
  '(--logfile)-l[Log to a file. Use - for stdout (default twistd.log)]:file to log to; use - for stdout:_files -g "*.log"' \
  '(-l)--logfile=[Log to a file. Use - for stdout (default twistd.log)]:file to log to; use - for stdout:_files -g "*.log"' \
  '--pidfile=[Save pid in specified file (default twistd.pid)]:file to save pid in:_files -g "*.pid"' \
  '--chroot=[Chroot to the given directory. This is done before changing the CWD]:directory to chroot to:_directories' \
  '(--rundir)-d[Change to the given directory before running (default .)]:directory to change to before running:_directories' \
  '(-d)--rundir=[Change to the given directory before running (default .)]:directory to change to before running:_directories' \
  "(--reactor)-r[Choose which ReactorCore event loop to use, such as 'poll' or 'gtk']:which reactor to use:((cf\:twisted.internet.cfreactor default\:twisted.internet.default glade\:twisted.manhole.gladereactor gtk\:twisted.internet.gtkreactor gtk2\:twisted.internet.gtk2reactor kqueue\:twisted.internet.kqreactor poll\:twisted.internet.pollreactor qt\:twisted.internet.qtreactor win\:twisted.internet.win32eventreactor win32\:twisted.internet.win32eventreactor wx\:twisted.internet.wxreactor))" \
  "(-r)--reactor=[Choose which ReactorCore event loop to use, such as 'poll' or 'gtk']:which reactor to use:((cf\:twisted.internet.cfreactor default\:twisted.internet.default glade\:twisted.manhole.gladereactor gtk\:twisted.internet.gtkreactor gtk2\:twisted.internet.gtk2reactor kqueue\:twisted.internet.kqreactor poll\:twisted.internet.pollreactor qt\:twisted.internet.qtreactor win\:twisted.internet.win32eventreactor win32\:twisted.internet.win32eventreactor wx\:twisted.internet.wxreactor))" \
  '--spew[Print an insanely verbose log of everything that happens]' \
  '(--file -x --xml -s --source -y --python)-f[Read the given .tap file (default twistd.tap)]:a .tap file to load:_files -g "*.tap"' \
  '(-f -x --xml -s --source -y --python)--file=[Read the given .tap file (default twistd.tap)]:a .tap file to load:_files -g "*.tap"' \
  '(--xml -f --file -s --source -y --python)-x[Read an application from the given .tax (Marmalade format) file]:a .tax file to load:_files -g "*.tax"' \
  '(-x -f --file -s --source -y --python)--xml=[Read an application from the given .tax (Marmalade format) file]:a .tax file to load:_files -g "*.tax"' \
  '(--source -f --file -x --xml -y --python)-s[Read an application from the given .tas (AOT format) file]:a .tas file to load:_files -g "*.tas"' \
  '(-s -f --file -x --xml -y --python)--source=[Read an application from the given .tas (AOT format) file]:a .tas file to load:_files -g "*.tas"' \
  "(--python -f --file -x --xml -s --source)-y[Read an application from the given .py file]:a .py file to load:_files -g '*.py'" \
  "(-y -f --file -x --xml -s --source)--python=[Read an application from the given .py file]:a .py file to load:_files -g '*.py'" \
  '(--plugin)-g[Read config.tac from a plugin package]:the plugin name: ' \
  '(-g)--plugin=[Read config.tac from a plugin package]:the plugin name: ' \
  '--syslog[Log to syslog, not to file]' \
  "--prefix=[Use the given prefix when syslogging (default 'twisted')]:a prefix string for each syslog message: " \
  && return 0
