BIG FORMATING COMMIT

This commit is contained in:
2023-07-30 15:55:22 +02:00
parent 088fce0aaa
commit 91972107eb
103 changed files with 1610 additions and 1585 deletions

View File

@@ -8,51 +8,51 @@ import lib.exporter.Import;
import lib.CLIAppBase;
class Res extends CLIAppBase {
public function new() {
registerAsyncSubcommand("get", (args)->{
var url = args[0];
public function new() {
registerAsyncSubcommand("get", (args) -> {
var url = args[0];
return Import.get(url).map((res)->{
switch (res){
case Success(data):
handle.writeLine(Std.string(data));
case Failure(err):
handle.writeLine("Error: ");
handle.writeLine(Std.string(err));
}
return true;
});
},"<url>");
return Import.get(url).map((res) -> {
switch (res) {
case Success(data):
handle.writeLine(Std.string(data));
case Failure(err):
handle.writeLine("Error: ");
handle.writeLine(Std.string(err));
}
return true;
});
}, "<url>");
registerAsyncSubcommand("register",(args)->{
var srv: Null<ResManager> = ServiceManager.get("resmgr");
registerAsyncSubcommand("register", (args) -> {
var srv:Null<ResManager> = ServiceManager.get("resmgr");
var addr = args[0];
var name = args[1];
var addr = args[0];
var name = args[1];
if (srv == null) {
handle.writeLine("Error: resmgr not found");
return false;
}
if (srv == null) {
handle.writeLine("Error: resmgr not found");
return false;
}
var perf: kernel.peripherals.Redstone = Peripheral.getRedstone(addr);
var perf:kernel.peripherals.Redstone = Peripheral.getRedstone(addr);
if (perf == null) {
handle.writeLine("Error: peripheral not found");
return false;
}
if (perf == null) {
handle.writeLine("Error: peripheral not found");
return false;
}
return srv.register(name,new Export(perf)).map((res)->{
switch (res){
case Success(_):
handle.writeLine("Success");
return true;
case Failure(err):
handle.writeLine("Error: ");
handle.writeLine(Std.string(err));
return false;
}
});
},"<addr> <name>");
}
}
return srv.register(name, new Export(perf)).map((res) -> {
switch (res) {
case Success(_):
handle.writeLine("Success");
return true;
case Failure(err):
handle.writeLine("Error: ");
handle.writeLine(Std.string(err));
return false;
}
});
}, "<addr> <name>");
}
}