       @listInstalledPackages(options)
       callback()
     else
-      @listBundledPackages options, (err, packages) =>
+      @listBundledPackages options, (error, packages) =>
         @logPackages(packages, options)
         @listInstalledPackages(options)
         callback()

      callback?(null, packages)

  listInstalledPackages: (options) ->
    @listDevPackages options, (err, packages) =>
      @logPackages(packages, options)
    @listUserPackages options, (err, packages) =>
      @logPackages(packages, options)

  listPackagesAsJson: (options) ->
    out =
      core: []
      dev: []
      user: []

    @listBundledPackages options, (err, packages) =>
      out.core = packages
      @listDevPackages options, (err, packages) =>
        out.dev = packages
        @listUserPackages options, (err, packages) =>
          out.user = packages
          console.log JSON.stringify(out)


  run: (options) ->
    {callback} = options

      _atomPackages ?= {}

      if options.argv.json
        packageMetadata = (v.metadata for k, v of _atomPackages)
        packages = packageMetadata.filter ({name}) ->
          packageDependencies.hasOwnProperty(name)
      else
