    process.on 'exit', exit
    process.on 'SIGINT', -> process.exit 0
    
+   # TODO: More robust file resolution
+   readFilesAsync = (files)->
+      bluebird.map files, (file)->
+         fs.readFileAsync(file, 'utf8').then (source)-> { from: file, code: source }
    
 # ---- --- ---- --- ----
    

{{#flag}}   --help{{/flag}}:        Show usage information
{{#flag}}   --version{{/flag}}:     Show version information
            
         
         Paws.js also accepts several environment variables, in the form:
{{#pre}}   > VAR=value paws.js ...{{/pre}}

   if (argf.version)
      return version()
   
   sources = _([argf.e, argf.expr, argf.expression])
      .flatten().compact().map (expression)-> { from: expression, code: expression }
      .value()
   
   help() if _.isEmpty argv[0]
   choose = -> switch operation = argv.shift()
      
      when 'pa', 'parse'
         readFilesAsync(argv).then (files)->
            sources.push files...
            _.forEach sources, (source)->
               Paws.info "-- Parse-tree for '#{T.bold source.from}':"
               expr = Paws.parser.parse source.code, root: true
               out.write expr.serialize() + "\n"
      
      when 'st', 'start'
         readFilesAsync(argv).then (files)->
            sources.push files...
            _.forEach sources, (source)->
               Paws.info "-- Staging '#{T.bold source.from}' from the command-line ..."
               expr = Paws.parser.parse source.code, root: true
               
               here = new Paws.reactor.Unit
               here.stage new Execution expr
               
               here.start() unless argf.start == false
      
      else argv.unshift('start', operation) and choose()
   
   choose()

prettify.skipNodeFiles()
bluebird.onPossiblyUnhandledRejection (error)->
