Updated update.js to be self-contained
This commit is contained in:
		@@ -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!');
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user