UNPKG

574 BJavaScriptView Raw
1/* globals mv */
2function pushStackDown (shiftStart, shiftUpto, leafs, callback) {
3 const path = require('path')
4 const chalk = require('chalk')
5
6 let pages = leafs * 2
7
8 process.stdout.write(chalk.yellow('Shaking stack… [ DOWN ]: '))
9
10 for (let pageIndex = shiftUpto; pageIndex >= shiftStart; pageIndex--) {
11 mv(path.join('__dirname', '..', 'manuscript', `page-${pageIndex}`), path.join('__dirname', '..', 'manuscript', `page-${pageIndex + pages}`))
12 }
13
14 if (typeof callback === 'function') {
15 callback()
16 }
17}
18
19module.exports.pushStackDown = pushStackDown