MCPcopy Create free account
hub / github.com/BaseXdb/basex / console

Method console

basex-core/src/main/java/org/basex/BaseX.java:172–199  ·  view source on GitHub ↗

Launches the console mode, which reads and executes user input.

()

Source from the content-addressed store, hash-verified

170 * Launches the console mode, which reads and executes user input.
171 */
172 private void console() {
173 Util.println(header() + NL + TRY_MORE_X);
174 verbose = true;
175
176 // create console reader
177 try(ConsoleReader cr = ConsoleReader.get()) {
178 // loop until console is set to false (may happen in server mode)
179 while(console) {
180 // get next line
181 final String in = cr.readLine(PROMPT);
182 // end of input: break loop
183 if(in == null) break;
184 // skip empty lines
185 if(in.isEmpty()) continue;
186
187 try {
188 if(!execute(CommandParser.get(in, context).pwReader(cr))) {
189 // show goodbye message if method returns false
190 Util.println(BYE[new Random().nextInt(4)]);
191 break;
192 }
193 } catch(final IOException ex) {
194 // output error messages
195 Util.errln(ex);
196 }
197 }
198 }
199 }
200
201 /**
202 * Quits the console mode.

Callers 3

BaseXMethod · 0.95
UtilClass · 0.80
passwordMethod · 0.80

Calls 9

printlnMethod · 0.95
headerMethod · 0.95
getMethod · 0.95
getMethod · 0.95
errlnMethod · 0.95
pwReaderMethod · 0.80
executeMethod · 0.65
readLineMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected