print help in rs command

This commit is contained in:
Djeeberjr 2023-02-04 20:44:02 +01:00
parent af8241505f
commit dabc42ea25

View File

@ -13,6 +13,11 @@ class Redstone extends CLIApp {
public function invoke(handle:TermHandle):Future<Bool> { public function invoke(handle:TermHandle):Future<Bool> {
var subcommand = handle.args[0]; var subcommand = handle.args[0];
if (subcommand == null) {
handle.writeLn("Usage: redstone <on|off|get> <side>");
return Future.sync(false);
}
var side:Null<Side> = handle.args[1]; var side:Null<Side> = handle.args[1];
if (side == null) { if (side == null) {
handle.writeLn("Invalid side"); handle.writeLn("Invalid side");
@ -27,6 +32,8 @@ class Redstone extends CLIApp {
case "get": case "get":
var value = Peripheral.instance.getRedstone(side).getAnalogInput(); var value = Peripheral.instance.getRedstone(side).getAnalogInput();
handle.writeLn("Analog input: " + value); handle.writeLn("Analog input: " + value);
case "help":
handle.writeLn("Usage: redstone <on|off|get> <side>");
default: default:
handle.writeLn("Invalid subcommand"); handle.writeLn("Invalid subcommand");
return Future.sync(false); return Future.sync(false);