2
0

copy.js 688 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env node
  2. const argv = process.argv
  3. if (argv.length <= 4) {
  4. console.log('Usage: node copy.js from to name')
  5. return
  6. }
  7. const fromParam = argv[2]
  8. const toParam = argv[3]
  9. const newName = argv[4]
  10. console.log("Try copy " + fromParam + " to " + toParam + "\n\n")
  11. var shelljs = require('shelljs');
  12. var addCheckMark = require('./checkmark');
  13. var path = require('path');
  14. var cpy = path.join(__dirname, '../node_modules/cpy-cli/cli.js');
  15. shelljs.exec("node " + cpy + ' ' + fromParam + ' ' + toParam + ' --rename=' + newName, addCheckMark.bind(null, callback));
  16. function callback() {
  17. process.stdout.write(' Copied ' + fromParam + ' to the ' + toParam + ' directory\n\n');
  18. }