 #
 # The function called when `kdc-plus compile` is used.
 compile = (appPath, unknownArgs..., opts={}, log=console.error) ->
-  if typeof appPath isnt 'string' then [appPath, opts] = [opts, undefined]
-  log 'Error: Not Implemented'
-  process.exit 1
+  if typeof appPath is 'object' then [opts, appPath] = [appPath, undefined]
 
+  appPath ?= process.cwd()
   appPath = path.resolve appPath
   loadOpts =
     validate: true

    else
      opts.commonjs = false

    # Remember, coffee defaults to on. So we allow the option of turning it off
    if opts.coffee is false
      opts.coffee = opts.coffee
    else if manifest.coffee is false
      opts.coffee = manifest.coffee


    if vwarns? then log warning for warning in vwarns
    if vfails?
      log failure for failure in vfails
      return process.exit 1

    cwd = process.cwd()
    files = manifest.source.blocks.app.files
    files[i] = path.join(appPath, file) for file,i in files

    if opts.commonjs
      cjsopts = extensions: []
      cjsopts.extensions.push '.coffee' if opts.coffee

  compileCmd.option '-f, --file <file>', 'Choose the output file'
  compileCmd.option '-c, --coffee', 'CoffeeScript support'
  compileCmd.option '-n, --commonjs', 'Commonjs support'
  compileCmd.action -> compile arguments..., log

  # Install command and opts
  installCmd  = program.command 'install'
  installCmd.description 'Install the KDApp dependencies, if any.'
  installCmd.option '--production', 'Install production dependencies only'
  installCmd.action -> install arguments..., log

  # Outdated command and opts
  outdatedCmd = program.command 'outdated'
