Skip to content

Instantly share code, notes, and snippets.

@thebyrd
Created February 24, 2014 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebyrd/9197447 to your computer and use it in GitHub Desktop.
Save thebyrd/9197447 to your computer and use it in GitHub Desktop.
Print like a boss
function print (m, n) { util.print(m+(!n?"\n":"")); return print; }
function help () {
print
("")
("Node Supervisor is used to restart programs when they crash.")
("It can also be used to restart programs when a *.js file changes.")
("")
("Usage:")
(" supervisor [options] <program>")
(" supervisor [options] -- <program> [args ...]")
("")
("Required:")
(" <program>")
(" The program to run.")
("")
("Options:")
(" -w|--watch <watchItems>")
(" A comma-delimited list of folders or js files to watch for changes.")
(" When a change to a js file occurs, reload the program")
(" Default is '.'")
("")
(" -i|--ignore <ignoreItems>")
(" A comma-delimited list of folders to ignore for changes.")
(" No default")
("")
(" -p|--poll-interval <milliseconds>")
(" How often to poll watched files for changes.")
(" Defaults to Node default.")
("")
(" -e|--extensions <extensions>")
(" Specific file extensions to watch in addition to defaults.")
(" Used when --watch option includes folders")
(" Default is 'node,js'")
("")
(" -x|--exec <executable>")
(" The executable that runs the specified program.")
(" Default is 'node'")
("")
(" --debug")
(" Start node with --debug flag.")
("")
(" --debug-brk[=port]")
(" Start node with --debug-brk[=port] flag.")
("")
(" --harmony")
(" Start node with --harmony flag.")
("")
(" -n|--no-restart-on error|exit")
(" Don't automatically restart the supervised program if it ends.")
(" Supervisor will wait for a change in the source files.")
(" If \"error\", an exit code of 0 will still restart.")
(" If \"exit\", no restart regardless of exit code.")
("")
(" --force-watch")
(" Use fs.watch instead of fs.watchFile.")
(" This may be useful if you see a high cpu load on a windows machine.")
("")
(" -h|--help|-?")
(" Display these usage instructions.")
("")
(" -q|--quiet")
(" Suppress DEBUG messages")
("")
(" -V|--verbose")
(" Show extra DEBUG messages")
("")
("Examples:")
(" supervisor myapp.js")
(" supervisor myapp.coffee")
(" supervisor -w scripts -e myext -x myrunner myapp")
(" supervisor -- server.js -h host -p port")
("");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment