added inspect command to turtleCtl
This commit is contained in:
parent
90b4015ba1
commit
fe17b4fd67
@ -1,5 +1,6 @@
|
||||
package bin;
|
||||
|
||||
import kernel.turtle.Types.ToolSide;
|
||||
import lib.turtle.Helper;
|
||||
import kernel.turtle.TurtleMutex;
|
||||
import kernel.turtle.Turtle;
|
||||
@ -116,6 +117,28 @@ class TurtleCtl extends CLIAppBase {
|
||||
var len = args.getInt("length");
|
||||
return asynPerform(Helper.combine.bind([Turtle.digEmpty.bind(Front), Turtle.forward, Turtle.digEmpty.bind(Up)]), len);
|
||||
}, [Int("length")]);
|
||||
|
||||
registerSyncSubcommand("inspect", (args) -> {
|
||||
var res = Turtle.inspect(Front);
|
||||
|
||||
switch res {
|
||||
case Failure(err):
|
||||
handle.writeLine("Failed: " + err);
|
||||
return false;
|
||||
case Success(data):
|
||||
handle.writeLine('Name: ${data.name}');
|
||||
handle.writeLine("Tags:");
|
||||
|
||||
for (tag in data.tags.sortByName()) {
|
||||
handle.writeLine(' ${tag}');
|
||||
}
|
||||
|
||||
handle.writeLine("State:");
|
||||
handle.writeLine(data.state);
|
||||
}
|
||||
|
||||
return true;
|
||||
}, []);
|
||||
}
|
||||
|
||||
private function asynPerform(op:Void->Outcome<Noise, String>, times:Int):Future<Bool> {
|
||||
|
Loading…
Reference in New Issue
Block a user