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

Method BaseX

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

Constructor. @param args command-line arguments @throws IOException I/O exception

(final String... args)

Source from the content-addressed store, hash-verified

54 * @throws IOException I/O exception
55 */
56 public BaseX(final String... args) throws IOException {
57 super(new Context(), args);
58
59 // create session to show optional login request
60 session();
61
62 console = true;
63 try {
64 // loop through all commands
65 final StringBuilder bind = new StringBuilder();
66 SerializerOptions sopts = null;
67 boolean v = false, qi = false, qp = false;
68 final int os = ops.size();
69 for(int o = 0; o < os; o++) {
70 final int c = ops.get(o);
71 String value = vals.get(o);
72
73 switch(c) {
74 case 'b':
75 if(!bind.isEmpty()) bind.append(',');
76 // commas are escaped by a second comma
77 value = bind.append(value.replace(",", ",,")).toString();
78 execute(new Set(MainOptions.BINDINGS, value), false);
79 break;
80 case 'c':
81 console = false;
82 if(!execute(commands(value))) return;
83 break;
84 case 'C':
85 console = false;
86 if(!execute(script(value))) return;
87 break;
88 case 'i':
89 execute(new Set(MainOptions.MAINMEM, true), false);
90 execute(new Check(value), verbose);
91 execute(new Set(MainOptions.MAINMEM, false), false);
92 break;
93 case 'I':
94 if(!bind.isEmpty()) bind.append(',');
95 // commas are escaped by a second comma
96 value = bind.append('=').append(value.replace(",", ",,")).toString();
97 execute(new Set(MainOptions.BINDINGS, value), false);
98 break;
99 case 'o':
100 quit();
101 out = new PrintOutput(new IOFile(value));
102 fileOutput = true;
103 break;
104 case 'O': {
105 final String[] kv = value.split("=", 2);
106 execute(new Set(kv[0], kv.length > 1 ? kv[1] : ""), false);
107 break;
108 }
109 case 'q':
110 console = false;
111 execute(new XQuery(value), verbose);
112 break;
113 case 'Q':

Callers

nothing calls this directly

Calls 15

quitMethod · 0.95
getMethod · 0.95
readStringMethod · 0.95
pathMethod · 0.95
toIntMethod · 0.95
assignMethod · 0.95
consoleMethod · 0.95
scriptMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
appendMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected