Updated update.js to be self-contained
This commit is contained in:
		
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								README.md
									
									
									
									
									
								
							@@ -61,16 +61,18 @@ Options:
 | 
			
		||||
 | 
			
		||||
### [update.js](./scripts/update.js)
 | 
			
		||||
**RAM:** 1.60 GB
 | 
			
		||||
 | 
			
		||||
Automatically download the latest versions of all scripts using wget.
 | 
			
		||||
```
 | 
			
		||||
[home ~/]> run scripts/update.js --help
 | 
			
		||||
Running script with 1 thread(s), pid 129 and args: ["--help"].
 | 
			
		||||
/scripts/update.js: 
 | 
			
		||||
 | 
			
		||||
Automatically update scripts from the repository using wget.
 | 
			
		||||
 | 
			
		||||
Usage:	run update.js
 | 
			
		||||
	run update.js --help
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
	-h --help		 Display help message
 | 
			
		||||
[home ~/]> run scripts/update.js
 | 
			
		||||
Running script with 1 thread(s), pid 142 and args: [].
 | 
			
		||||
/scripts/update.js: Downloading scripts:
 | 
			
		||||
/scripts/update.js: lib/arg-parser.js	[==================>] 100% 	 (15 MB/s)
 | 
			
		||||
/scripts/update.js: auto-pwn.js		[==================>] 100% 	 (22.3 MB/s)
 | 
			
		||||
/scripts/update.js: bruteforce.js	[==================>] 100% 	 (22 MB/s)
 | 
			
		||||
/scripts/update.js: crawler.js		[==================>] 100% 	 (26.2 MB/s)
 | 
			
		||||
/scripts/update.js: miner.js		[==================>] 100% 	 (10.8 MB/s)
 | 
			
		||||
/scripts/update.js: node-manager.js	[==================>] 100% 	 (14.6 MB/s)
 | 
			
		||||
/scripts/update.js: update.js		[==================>] 100% 	 (11.1 MB/s)
 | 
			
		||||
/scripts/update.js: ✅ Done!
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -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