diff --git a/src/bin/TurtleCtl.hx b/src/bin/TurtleCtl.hx index 32c237a..25733b8 100644 --- a/src/bin/TurtleCtl.hx +++ b/src/bin/TurtleCtl.hx @@ -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, times:Int):Future {