"use strict";

var _path = _interopRequireDefault(require("path"));

var _fs = _interopRequireDefault(require("fs"));

var _fileUtils = require("./fileUtils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

let args = process.argv.slice(2);

let appPath = _fs.default.realpathSync(process.cwd());

let [srcPath, targetPath, exts, isCopy = true, flatten = '', changeExt = ''] = args;
exts = exts ? exts.split(',').map(ext => `.${ext.trim()}`) : false;
srcPath = _path.default.join(appPath, srcPath);
targetPath = targetPath === '."' || !targetPath ? '' : targetPath;
targetPath = _path.default.join(appPath, targetPath);
changeExt = changeExt.split(',').reduce((obj, ext) => {
  let [key, value] = ext.split('~');
  obj[key] = value;
  return obj;
}, {});
(0, _fileUtils.copy)(srcPath, targetPath, isCopy, exts, flatten, changeExt);