package bin; import kernel.KernelSettings; import lib.CLIAppBase; class KSettings extends CLIAppBase { public function new() { registerSyncSubcommand("get", (args)->{ var key = args[0]; if (key == null) { handle.writeLine("Key not specified"); return false; } var value = switch (key){ case "hostname": KernelSettings.hostname; case "sitecontroller": Std.string(KernelSettings.siteController); default: null; } if (value == null) { handle.writeLine("Key not found or not set"); return false; } handle.writeLine(value); return true; }," "); registerSyncSubcommand("set", (args)->{ var key = args[0]; if (key == null) { handle.writeLine("Key not specified"); return false; } var value = args[1]; if (value == null) { handle.writeLine("Value not specified"); return false; } switch (key){ case "hostname": KernelSettings.hostname = value; case "sitecontroller": KernelSettings.siteController = Std.parseInt(value); default: handle.writeLine("Key not found"); return false; } return true; }," "); registerSyncSubcommand("list", (args)->{ handle.writeLine("hostname"); handle.writeLine("sitecontroller"); return true; }); } }