in gshell-commands/gshell-builtin/src/main/java/org/apache/geronimo/gshell/commands/builtin/SetAction.java [92:155]
private Object displayList(final CommandContext context) throws Exception {
assert context != null;
IO io = context.getIo();
// NOTE: Using io.outputStream to display values to avoid any ANSI encoding or other translation.
switch (mode) {
case PROPERTY: {
Properties props = System.getProperties();
for (Object o : props.keySet()) {
String name = (String) o;
String value = props.getProperty(name);
io.outputStream.print(name);
io.outputStream.print("='");
io.outputStream.print(value);
io.outputStream.print("'");
// Value is always a string, so no need to add muck here for --verbose
io.outputStream.println();
}
break;
}
case VARIABLE: {
Variables variables = context.getVariables();
Iterator<String> iter = variables.names();
while (iter.hasNext()) {
String name = iter.next();
// HACK: Hide some internal muck for now
if (name.startsWith("gshell.internal")) {
continue;
}
Object value = variables.get(name);
io.outputStream.print(name);
io.outputStream.print("='");
io.outputStream.print(value);
io.outputStream.flush();
io.outputStream.print("'");
// When --verbose include the class details of the value
if (verbose && value != null) {
io.outputStream.print(" (");
io.outputStream.print(value.getClass());
io.outputStream.print(")");
}
io.outputStream.println();
}
break;
}
}
// Manually flush the stream, normally framework only flushes io.out
io.outputStream.flush();
return Result.SUCCESS;
}