Updated update.js to be self-contained

This commit is contained in:
2022-02-10 17:28:51 +00:00
parent bdfcdefac0
commit 2d7ea8867c
2 changed files with 15 additions and 30 deletions

View File

@ -1,29 +1,12 @@
import {ArgParser} from './scripts/lib/arg-parser';
/**
* Automatically download all the scripts in the repository.
*/
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
const src = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
const dist = '/scripts/';
const fileList = [
'lib/arg-parser.js',
'auto-pwn.js',
'bruteforce.js',
'crawler.js',
@ -40,5 +23,5 @@ export async function main(ns) {
const speed = ~~((Math.random() * 200) + 100) / 10;
ns.tprint(`${file} ${file.length <= 10 ? '\t' : ''}\t [==================>] 100% \t (${speed} MB/s)`);
}
ns.tprint('Done!');
ns.tprint('Done!');
}