renamed Perf to Peri
This commit is contained in:
33
src/bin/Peri.hx
Normal file
33
src/bin/Peri.hx
Normal file
@@ -0,0 +1,33 @@
|
||||
package bin;
|
||||
|
||||
import kernel.peripherals.Peripherals.Peripheral;
|
||||
import lib.CLIAppBase;
|
||||
|
||||
@:build(macros.Binstore.includeBin("Peripheral", ["ph", "peripheral"]))
|
||||
class Peri extends CLIAppBase {
|
||||
public function new() {
|
||||
registerSyncSubcommand("inspect", (args) -> {
|
||||
var addr = args.getString("addr");
|
||||
var result = Peripheral.inspect(addr);
|
||||
|
||||
handle.writeLine("Types:");
|
||||
for (type in result.types) {
|
||||
handle.writeLine(" " + type);
|
||||
}
|
||||
|
||||
handle.writeLine("Methods:");
|
||||
for (method in result.methods) {
|
||||
handle.writeLine(" " + method);
|
||||
}
|
||||
|
||||
return true;
|
||||
}, [Addr("addr")]);
|
||||
|
||||
registerSyncSubcommand("list", (args) -> {
|
||||
for (addr in Peripheral.getAllAddresses()) {
|
||||
handle.writeLine('$addr => ${Peripheral.getTypes(addr).join(", ")}');
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user