import CommandBuilder from "../builders/command";

function echoHandler(args, context) {
    if (args[1] != "on" && args[1] != "off") {
        context.print(`Usage: echo <on/off>`);
    } else {
        context.setInputEcho(args[1] == "on" ? true : false);
        context.print(`Command echo is now ${args[1]}.`);
    }
}

export default new CommandBuilder()
    .withName("echo")
    .withCategory("System")
    .withDescription("Toggle command echo")
    .withArgument("select", "state", false, "Echo state")
    .withHandler(echoHandler)
    .create();