Skip to content

Instantly share code, notes, and snippets.

@525c1e21-bd67-4735-ac99-b4b0e5262290
Created December 26, 2010 01:53
Show Gist options
  • Save 525c1e21-bd67-4735-ac99-b4b0e5262290/755146 to your computer and use it in GitHub Desktop.
Save 525c1e21-bd67-4735-ac99-b4b0e5262290/755146 to your computer and use it in GitHub Desktop.
OptionParser = require('coffee-script/optparse').OptionParser
switches = [
['-h', '--help', 'Displays this wonderful, elucidative help message']
['-v', '--version', 'Shows zappa version']
['-p', '--port [NUMBER]', 'The port(s) the app(s) will listen on. Ex.: 8080 or 4567,80,3000']
['-n', '--hostname [STRING]', 'If omitted, will accept connections to any ipv4 address (INADDR_ANY)']
['-c', '--compile', 'Compiles the app(s) to a .js file instead of running them.']
['-w', '--watch', 'Keeps watching the file and restarts the app when it changes.']
]
parser = new OptionParser switches, usage
options = parser.parse process.argv
console.log options.arguments
Nicholas-Kinseys-MacBook-Pro:zappa pyrotechnick$ npm activate [email protected]
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info predeactivate [email protected]
npm info deactivate [email protected]
npm info postdeactivate [email protected]
npm info preactivate [email protected]
npm info activate [email protected]
npm info postactivate [email protected]
npm ok
Nicholas-Kinseys-MacBook-Pro:~ pyrotechnick$ coffee optionparsertest.coffee --port 1,2 --watch a
[ 'a' ]
Nicholas-Kinseys-MacBook-Pro:~ pyrotechnick$ npm activate [email protected]
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info predeactivate [email protected]
npm info deactivate [email protected]
npm info postdeactivate [email protected]
npm info preactivate [email protected]
npm info activate [email protected]
npm info postactivate [email protected]
npm ok
Nicholas-Kinseys-MacBook-Pro:~ pyrotechnick$ coffee optionparsertest.coffee --port 1,2 --watch a
[ 'node'
, '/usr/local/bin/coffee'
, '--port'
, '1,2'
, '--watch'
, 'a'
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment