   jsl.write js
   jsl.close()
 
-# Pretty-print a token stream.
+# Pretty-print a stream of tokens.
 print_tokens: (tokens) ->
   strings: for token in tokens
     [tag, value]: [token[0], token[1].toString().replace(/\n/, '\\n')]
     "[$tag $value]"
   puts strings.join(' ')
 
-# Use OptionParser for all the options.
+# Use the [OptionParser module](optparse.html) to extract all options from
+# `process.ARGV` that are specified in `SWITCHES`.
 parse_options: ->
   option_parser: new optparse.OptionParser SWITCHES, BANNER
   options: option_parser.parse(process.ARGV)
   sources: options.arguments[2...options.arguments.length]
 
-# The options to pass to the CoffeeScript compiler.
+# The compile-time options to pass to the CoffeeScript compiler.
 compile_options: ->
   if options['no-wrap'] then {no_wrap: true} else {}
+
+# Print the `--help` usage message and exit.
+usage: ->
+  puts option_parser.help()
+  process.exit 0
+
+# Print the `--version` message and exit.
+version: ->
+  puts "CoffeeScript version ${CoffeeScript.VERSION}"
+  process.exit 0

optparse:     require 'optparse'
CoffeeScript: require 'coffee-script'

BANNER: '''
  coffee compiles CoffeeScript source files into JavaScript.


  process.stdio.addListener 'close', ->
    process.stdio.write CoffeeScript.compile code, compile_options()

# Watch a list of source CoffeeScript files using `fs.watchFile`, recompiling
# them every time the files are updated. May be used in combination with other
# options, such as `--lint` or `--print`.
watch_scripts: ->
  watch: (source) ->
    fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
