| 264 | } |
| 265 | |
| 266 | function undoFolder(oldPath, newPath, files, opts) { |
| 267 | const { verbose, git: useGit } = opts |
| 268 | |
| 269 | if (useGit) { |
| 270 | let cmd = `git mv ${oldPath} ${newPath}` |
| 271 | execSync(cmd) |
| 272 | if (verbose) { |
| 273 | console.log(`git mv command: ${chalk.grey(cmd)}`) |
| 274 | } |
| 275 | |
| 276 | cmd = `git commit -a -m "renamed ${files.length} files"` |
| 277 | execSync(cmd) |
| 278 | if (verbose) { |
| 279 | console.log(`git commit command: ${chalk.grey(cmd)}`) |
| 280 | } |
| 281 | } else { |
| 282 | fs.renameSync(oldPath, newPath) |
| 283 | if (verbose) { |
| 284 | console.log(`Renamed folder ${chalk.bold(oldPath)} to ${chalk.bold(newPath)}`) |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | function getBasename(fileOrDirectory) { |
| 290 | // Note, can't use fs.lstatSync().isDirectory() because it's just a string |