MCPcopy Create free account
hub / github.com/OperationT00/T-Code / read

Method read

src/main/java/com/tcode/cli/CliPromptInput.java:24–62  ·  view source on GitHub ↗
(Terminal terminal,
                            LineReader lineReader,
                            Renderer renderer,
                            boolean allowEscCancel,
                            boolean spaciousPrompt)

Source from the content-addressed store, hash-verified

22 }
23
24 static PromptInput read(Terminal terminal,
25 LineReader lineReader,
26 Renderer renderer,
27 boolean allowEscCancel,
28 boolean spaciousPrompt)
29 throws UserInterruptException, EndOfFileException {
30 if (spaciousPrompt) {
31 renderer.stream().println();
32 }
33 renderer.beforeInput();
34 try {
35 String prompt = renderer.inputPrompt();
36 String rightPrompt = renderer.inputRightPrompt();
37 if (!allowEscCancel) {
38 return PromptInput.submitted(lineReader.readLine(prompt, rightPrompt, (MaskingCallback) null, null));
39 }
40 if (terminal != null && terminal.writer() != null) {
41 terminal.writer().print(prompt);
42 terminal.writer().flush();
43 } else {
44 renderer.stream().print(prompt);
45 renderer.stream().flush();
46 }
47 CliTerminalInput.PrefillResult prefill = CliTerminalInput.readPrefill(terminal, lineReader);
48 if (prefill == null) {
49 return PromptInput.submitted(lineReader.readLine("", rightPrompt, (MaskingCallback) null, null));
50 }
51 if (prefill.canceled()) {
52 return PromptInput.canceledInput();
53 }
54 if (prefill.submitted()) {
55 return PromptInput.submitted("");
56 }
57 return PromptInput.submitted(
58 lineReader.readLine("", rightPrompt, (MaskingCallback) null, prefill.seedBuffer()));
59 } finally {
60 renderer.afterInput();
61 }
62 }
63
64 static boolean defaultSpaciousPrompt(boolean statusBarAvailable) {
65 return false;

Callers 5

mainMethod · 0.95
readEscCancelMethod · 0.45
readSingleKeyMethod · 0.45
readPrefillMethod · 0.45
readInputBurstMethod · 0.45

Calls 11

submittedMethod · 0.95
readPrefillMethod · 0.95
canceledInputMethod · 0.95
printMethod · 0.80
canceledMethod · 0.80
streamMethod · 0.65
beforeInputMethod · 0.65
inputPromptMethod · 0.65
inputRightPromptMethod · 0.65
afterInputMethod · 0.65
flushMethod · 0.45

Tested by

no test coverage detected