const comanche = require('./comanche')
const api = require('./plugins/api')
const cli = require('./plugins/cli')
const execution = require('./plugins/execution')
const validation = require('./plugins/validation')
const camelCase = require('./plugins/camelCase')

const DEFAULT_PLUGINS = [api, cli, execution, validation, camelCase]

module.exports = function defaultComanche(...args) {
  let plugins = DEFAULT_PLUGINS

  if (Array.isArray(args[args.length - 1])) {
    plugins = plugins.concat(args.pop())
  }

  return comanche(args, plugins)
}

const comanche = require('./comanche')
const api = require('./plugins/api')
const cli = require('./plugins/cli')
const execution = require('./plugins/execution')
const validation = require('./plugins/validation')
const camelCase = require('./plugins/camelCase')

const DEFAULT_PLUGINS = [execution, api, cli, validation, camelCase]

module.exports = function defaultComanche(...args) {
  let plugins = DEFAULT_PLUGINS

  if (Array.isArray(args[args.length - 1])) {
    plugins = plugins.concat(args.pop())
  }

  return comanche(args, plugins)
}

Make execution the first plugin in the queue