Updated update.js to be self-contained
This commit is contained in:
parent
bdfcdefac0
commit
2d7ea8867c
24
README.md
24
README.md
@ -61,16 +61,18 @@ Options:
|
|||||||
|
|
||||||
### [update.js](./scripts/update.js)
|
### [update.js](./scripts/update.js)
|
||||||
**RAM:** 1.60 GB
|
**RAM:** 1.60 GB
|
||||||
|
|
||||||
|
Automatically download the latest versions of all scripts using wget.
|
||||||
```
|
```
|
||||||
[home ~/]> run scripts/update.js --help
|
[home ~/]> run scripts/update.js
|
||||||
Running script with 1 thread(s), pid 129 and args: ["--help"].
|
Running script with 1 thread(s), pid 142 and args: [].
|
||||||
/scripts/update.js:
|
/scripts/update.js: Downloading scripts:
|
||||||
|
/scripts/update.js: lib/arg-parser.js [==================>] 100% (15 MB/s)
|
||||||
Automatically update scripts from the repository using wget.
|
/scripts/update.js: auto-pwn.js [==================>] 100% (22.3 MB/s)
|
||||||
|
/scripts/update.js: bruteforce.js [==================>] 100% (22 MB/s)
|
||||||
Usage: run update.js
|
/scripts/update.js: crawler.js [==================>] 100% (26.2 MB/s)
|
||||||
run update.js --help
|
/scripts/update.js: miner.js [==================>] 100% (10.8 MB/s)
|
||||||
|
/scripts/update.js: node-manager.js [==================>] 100% (14.6 MB/s)
|
||||||
Options:
|
/scripts/update.js: update.js [==================>] 100% (11.1 MB/s)
|
||||||
-h --help Display help message
|
/scripts/update.js: ✅ Done!
|
||||||
```
|
```
|
||||||
|
@ -1,29 +1,12 @@
|
|||||||
import {ArgParser} from './scripts/lib/arg-parser';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically download all the scripts in the repository.
|
* Automatically download all the scripts in the repository.
|
||||||
*/
|
*/
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// Initilize script arguments
|
|
||||||
const argParser = new ArgParser({
|
|
||||||
desc: 'Automatically update scripts from the repository using wget.',
|
|
||||||
examples: [
|
|
||||||
'run update.js',
|
|
||||||
'run update.js --help',
|
|
||||||
],
|
|
||||||
args: [
|
|
||||||
{key: 'help', alias: 'h', optional: true, desc: 'Display help message'},
|
|
||||||
]
|
|
||||||
});
|
|
||||||
const args = argParser.parse(ns.args);
|
|
||||||
|
|
||||||
// Check arguments
|
|
||||||
if(args['help']) return ns.tprint(argParser.help());
|
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
const src = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
|
const src = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
|
||||||
const dist = '/scripts/';
|
const dist = '/scripts/';
|
||||||
const fileList = [
|
const fileList = [
|
||||||
|
'lib/arg-parser.js',
|
||||||
'auto-pwn.js',
|
'auto-pwn.js',
|
||||||
'bruteforce.js',
|
'bruteforce.js',
|
||||||
'crawler.js',
|
'crawler.js',
|
||||||
@ -40,5 +23,5 @@ export async function main(ns) {
|
|||||||
const speed = ~~((Math.random() * 200) + 100) / 10;
|
const speed = ~~((Math.random() * 200) + 100) / 10;
|
||||||
ns.tprint(`${file} ${file.length <= 10 ? '\t' : ''}\t [==================>] 100% \t (${speed} MB/s)`);
|
ns.tprint(`${file} ${file.length <= 10 ? '\t' : ''}\t [==================>] 100% \t (${speed} MB/s)`);
|
||||||
}
|
}
|
||||||
ns.tprint('Done!');
|
ns.tprint('✅ Done!');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user