String product; try { product = textIO.newStringInputReader().withPropertiesPrefix("product").read("product"); } catch (ReadAbortedException e) { terminal.executeWithPropertiesPrefix("abort",
@Override public void accept(TextIO textIO, RunnerData runnerData) { TextTerminal<?> terminal = textIO.getTextTerminal(); String initData = (runnerData == null) ? null : runnerData.getInitData(); AppUtil.printGsonMessage(terminal, initData); terminal.executeWithPropertiesPrefix("custom.title", t -> t.print("Cuboid dimensions: ")); terminal.println(); double length = textIO.newDoubleInputReader() .withMinVal(0.0) .withPropertiesPrefix("custom.length") .read("Length"); double width = textIO.newDoubleInputReader() .withMinVal(0.0) .withPropertiesPrefix("custom.width") .read("Width"); double height = textIO.newDoubleInputReader() .withMinVal(0.0) .withPropertiesPrefix("custom.height") .read("Height"); terminal.executeWithPropertiesPrefix("custom.title", t -> t.print("The volume of your cuboid is: " + length * width * height)); terminal.println(); textIO.newStringInputReader() .withMinLength(0) .withPropertiesPrefix("custom.neutral") .read("\nPress enter to terminate..."); textIO.dispose(); }
.addChoices(0.59, 0.86, 0.99, 1.14, 1.55, 1.63, 1.74, 1.99, 2.55, 2.88, 2.99); handler.addStringTask("color", "Color", true) .withInputReaderConfigurator(r -> r.withPropertiesPrefix("highlight")) .addChoices("amaranth", "amber", "amethyst", "apricot", "aquamarine", "azure", "baby blue", "beige", "black", "blue", "blue-green", "blue-violet", "blush", "bronze", "brown", "burgundy", "byzantium", "carmine", "cerise", "cerulean", "champagne", "chartreuse", "chocolate", "cobalt blue", "coffee", "copper", "coral", "crimson", "cyan", "desert sand", "electric blue", "emerald", "erin", "gold", "gray", "green", "harlequin", "indigo", "ivory", "jade", "jungle green", "lavender", "lemon", "lilac", "lime", "magenta", "magenta rose", "maroon", "mauve", "navy blue", "ocher", "olive", "orange", "orange-red", "orchid", "peach", "pear", "periwinkle", "persian blue", "pink", "plum", "prussian blue", "puce", "purple", "raspberry", "red", "red-violet", "rose", "ruby", "salmon", "sangria", "sapphire", "scarlet", "silver", "slate gray", "spring bud", "spring green", "tan", "taupe", "teal", "turquoise", "violet", "viridian", "white", "yellow"); handler.execute();