Command Line Updates
This commit is contained in:
-1
@@ -1 +0,0 @@
|
||||
../extract-zip/cli.js
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable no-process-exit */
|
||||
|
||||
var extract = require('./')
|
||||
|
||||
var args = process.argv.slice(2)
|
||||
var source = args[0]
|
||||
var dest = args[1] || process.cwd()
|
||||
if (!source) {
|
||||
console.error('Usage: extract-zip foo.zip <targetDirectory>')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
extract(source, { dir: dest })
|
||||
.catch(function (err) {
|
||||
console.error('error!', err)
|
||||
process.exit(1)
|
||||
})
|
||||
-1
@@ -1 +0,0 @@
|
||||
../rimraf/bin.js
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const rimraf = require('./')
|
||||
|
||||
const path = require('path')
|
||||
|
||||
const isRoot = arg => /^(\/|[a-zA-Z]:\\)$/.test(path.resolve(arg))
|
||||
const filterOutRoot = arg => {
|
||||
const ok = preserveRoot === false || !isRoot(arg)
|
||||
if (!ok) {
|
||||
console.error(`refusing to remove ${arg}`)
|
||||
console.error('Set --no-preserve-root to allow this')
|
||||
}
|
||||
return ok
|
||||
}
|
||||
|
||||
let help = false
|
||||
let dashdash = false
|
||||
let noglob = false
|
||||
let preserveRoot = true
|
||||
const args = process.argv.slice(2).filter(arg => {
|
||||
if (dashdash)
|
||||
return !!arg
|
||||
else if (arg === '--')
|
||||
dashdash = true
|
||||
else if (arg === '--no-glob' || arg === '-G')
|
||||
noglob = true
|
||||
else if (arg === '--glob' || arg === '-g')
|
||||
noglob = false
|
||||
else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
|
||||
help = true
|
||||
else if (arg === '--preserve-root')
|
||||
preserveRoot = true
|
||||
else if (arg === '--no-preserve-root')
|
||||
preserveRoot = false
|
||||
else
|
||||
return !!arg
|
||||
}).filter(arg => !preserveRoot || filterOutRoot(arg))
|
||||
|
||||
const go = n => {
|
||||
if (n >= args.length)
|
||||
return
|
||||
const options = noglob ? { glob: false } : {}
|
||||
rimraf(args[n], options, er => {
|
||||
if (er)
|
||||
throw er
|
||||
go(n+1)
|
||||
})
|
||||
}
|
||||
|
||||
if (help || args.length === 0) {
|
||||
// If they didn't ask for help, then this is not a "success"
|
||||
const log = help ? console.log : console.error
|
||||
log('Usage: rimraf <path> [<path> ...]')
|
||||
log('')
|
||||
log(' Deletes all files and folders at "path" recursively.')
|
||||
log('')
|
||||
log('Options:')
|
||||
log('')
|
||||
log(' -h, --help Display this usage info')
|
||||
log(' -G, --no-glob Do not expand glob patterns in arguments')
|
||||
log(' -g, --glob Expand glob patterns in arguments (default)')
|
||||
log(' --preserve-root Do not remove \'/\' (default)')
|
||||
log(' --no-preserve-root Do not treat \'/\' specially')
|
||||
log(' -- Stop parsing flags')
|
||||
process.exit(help ? 0 : 1)
|
||||
} else
|
||||
go(0)
|
||||
+4
-2
@@ -94,9 +94,11 @@ async function savetoPDF() {
|
||||
bottom: "46",
|
||||
left: "10"
|
||||
}
|
||||
const browser = await puppeteer.launch();
|
||||
const browser = await puppeteer.launch({
|
||||
headless: true,
|
||||
args: ['--no-sandbox']});
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://server1.nicholaspease.com/reports/satellitepasspredictions.html');
|
||||
await page.goto('http://192.168.0.201/reports/satellitepasspredictions.html');
|
||||
await page.pdf({
|
||||
path: '/var/www/html/reports/satellitepasspredictions.pdf',
|
||||
printBackground: true,
|
||||
|
||||
Regular → Executable
+2
-2
@@ -1,2 +1,2 @@
|
||||
cd /home/npease/scripts/SatellitePredictionGenerator
|
||||
/usr/local/bin/node /home/npease/scripts/SatellitePredictionGenerator/satpredictionbot.js
|
||||
cd /root/scripts/SatellitePredictionGenerator
|
||||
/root/.nvm/versions/node/v19.3.0/bin/node /root/scripts/SatellitePredictionGenerator/satpredictionbot.js
|
||||
|
||||
Reference in New Issue
Block a user