mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 04:05:46 +01:00
Implemented 'rm' command. FIxed some bugs
This commit is contained in:
parent
558939fd85
commit
685103c5d4
@ -70,7 +70,7 @@ Tasks TODO:
|
||||
Tutorial and help - INTERACTIVE TUTORIAL
|
||||
Secret Servers
|
||||
|
||||
Hack time formula needs rebalancing I think
|
||||
Hack time formula needs rebalancing I think, so does hack exp
|
||||
|
||||
Create new menu page for purchased servers
|
||||
|
||||
|
@ -31,7 +31,8 @@ function runScriptsLoop() {
|
||||
try {
|
||||
var ast = Parser(Tokenizer(InputStream(workerScripts[i].code)));
|
||||
} catch (e) {
|
||||
post("Syntax error in " + workerScript[i].name + ": " + e);
|
||||
dialogBoxCreate("Syntax ERROR in " + workerScripts[i].name + ":", e, "", "");
|
||||
workerScripts[i].env.stopFlag = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -396,14 +396,41 @@ var Terminal = {
|
||||
break;
|
||||
case "ps":
|
||||
if (commandArray.length != 1) {
|
||||
post("Incorrect usage of ps command. Usage: ps");
|
||||
post("Incorrect usage of ps command. Usage: ps"); return;
|
||||
}
|
||||
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
|
||||
post(Player.getCurrentServer().runningScripts[i]);
|
||||
}
|
||||
break;
|
||||
case "rm":
|
||||
//TODO
|
||||
if (commandArray.length != 2) {
|
||||
post("Incorrect number of arguments. Usage: rm [program/script]"); return;
|
||||
}
|
||||
|
||||
//Check programs
|
||||
var delTarget = commandArray[1];
|
||||
var s = Player.getCurrentServer();
|
||||
for (var i = 0; i < s.programs.length; ++i) {
|
||||
if (s.programs[i] == delTarget) {
|
||||
s.programs.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Check scripts
|
||||
for (var i = 0; i < s.scripts.length; ++i) {
|
||||
if (s.scripts[i].filename == delTarget) {
|
||||
//Check that the script isnt currently running
|
||||
if (s.runningScripts.indexOf(delTarget) > -1) {
|
||||
post("Cannot delete a script that is currently running!");
|
||||
} else {
|
||||
s.scripts.splice(i, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
post("No such file exists");
|
||||
break;
|
||||
case "run":
|
||||
//Run a program or a script
|
||||
|
Loading…
Reference in New Issue
Block a user