fix shittyeditor so that it actually checks for multiple args - added getScreenSize helper
This commit is contained in:
parent
bea1953ce8
commit
e3ada827bb
3 changed files with 26 additions and 10 deletions
|
@ -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 {
|
public class Js {
|
||||||
private final ComputerBlockEntity entity;
|
private final ComputerBlockEntity entity;
|
||||||
|
|
19
src/main/java/dev/exhq/ajarc/vm/ScreenHelper.java
Normal file
19
src/main/java/dev/exhq/ajarc/vm/ScreenHelper.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,10 @@
|
||||||
var args = process.args
|
var args = process.args
|
||||||
var file = args[0]
|
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)
|
fs.writeFile(file, content)
|
Loading…
Reference in a new issue