fix shittyeditor so that it actually checks for multiple args - added getScreenSize helper

This commit is contained in:
amy 2024-07-26 14:06:13 +03:30
parent bea1953ce8
commit e3ada827bb
3 changed files with 26 additions and 10 deletions

View file

@ -129,15 +129,6 @@ public class JsVm {
}
public record ScreenHelper(ComputerBlockEntity entity) {
public void setScreenSize(int rows, int cols) {
entity.setTerminal(ComputerTerminal.ofSize(rows, cols));
}
public void print(String line) {
entity.addLine(line);
}
}
public class Js {
private final ComputerBlockEntity entity;

View file

@ -0,0 +1,19 @@
package dev.exhq.ajarc.vm;
import dev.exhq.ajarc.computer.ComputerBlockEntity;
import dev.exhq.ajarc.computer.ComputerTerminal;
public record ScreenHelper(ComputerBlockEntity entity) {
public ComputerTerminal.Dimensions getScreenSize(){
return entity.getTerminal().dimensions();
}
public void setScreenSize(int rows, int cols) {
entity.setTerminal(ComputerTerminal.ofSize(rows, cols));
}
public void print(String line) {
entity.addLine(line);
}
}

View file

@ -1,4 +1,10 @@
var args = process.args
var file = args[0]
var content = args[1]
//var content = args[1]
var content = ""
for(var i = 0; i < args.length; i++){
if (i !== 0) {
content = content + args[i] + " "
}
}
fs.writeFile(file, content)