MCPcopy Index your code
hub / github.com/github/docs / moveFolder

Function moveFolder

script/move-content.js:244–264  ·  view source on GitHub ↗
(oldPath, newPath, files, opts)

Source from the content-addressed store, hash-verified

242}
243
244function moveFolder(oldPath, newPath, files, opts) {
245 const { verbose, git: useGit } = opts
246 if (useGit) {
247 let cmd = `git mv ${oldPath} ${newPath}`
248 if (verbose) {
249 console.log(`git mv command: ${chalk.grey(cmd)}`)
250 }
251 execSync(cmd)
252
253 cmd = `git commit -a -m "renamed ${files.length} files"`
254 if (verbose) {
255 console.log(`git commit command: ${chalk.grey(cmd)}`)
256 }
257 execSync(cmd)
258 } else {
259 fs.renameSync(oldPath, newPath)
260 if (verbose) {
261 console.log(`Renamed folder ${chalk.bold(oldPath)} to ${chalk.bold(newPath)}`)
262 }
263 }
264}
265
266function undoFolder(oldPath, newPath, files, opts) {
267 const { verbose, git: useGit } = opts

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected