#!/usr/bin/env node

var _ = require('lodash')
var yargs = require('yargs')

var installer = require('./installer')
var pkg = require('../package.json')

var argv = yargs
  .version(pkg.version)
  .usage(pkg.description + '\n\nUsage: $0 --src <inputdir> --dest <outputdir>')
  .option('src', {
    describe: 'Directory that contains your built Electron app (e.g. with `electron-packager`)',
    demand: true
  })
  .option('dest', {
    describe: 'Directory that will contain the resulting Windows installer',
    demand: true
  })
  .option('config', {
    describe: 'JSON file that contains the metadata for your application',
    config: true
  })
  .example('$0 --src dist/app/ --dest dist/installer/', 'use metadata from `dist/app/`')
  .example('$0 --src dist/app/ --dest dist/installer/ --config config.json', 'use metadata from `config.json`')
  .wrap(null)
  .argv

console.log('Creating package (this may take a while)')

var options = _.omit(argv, ['$0', '_', 'version'])
installer(options, function (err) {
  if (err) {
    console.error(err, err.stack)
    process.exit(1)
  }

  console.log('Successfully created package at ' + argv.dest)
})

@@ -976,16 +976,17 @@
 sion'%5D)%0A
+%0A
 installe
@@ -998,37 +998,100 @@
 ions
-, function (err) %7B%0A  if 
+)%0A  .then(() =%3E console.log(%60Successfully created package at $%7Bargv.dest%7D%60))%0A  .catch
 (err
-)
+ =%3E
  %7B%0A 
@@ -1150,71 +1150,6 @@
 %0A  %7D
-%0A%0A  console.log('Successfully created package at ' + argv.dest)%0A%7D
 )%0A

Use promise installer when using CLI