final int argc = st.countTokens();
if (cmd.startsWith("re")) { // 'reset-property'
if (argc == 1) {
final String name = st.nextToken();
PropertyHolder holder;
holder = getRegistry().getPropertyMap().get(name);
if (holder == null) {
return EXEC_FAILED;
}
final String defaultValue = holder.getDefaultValue();
try {
holder.setValue(defaultValue);
} catch (final Exception e) {
HenPlus.msg().println("setting to default '" + defaultValue + "' failed.");
return EXEC_FAILED;
}
return SUCCESS;
}
return SYNTAX_ERROR;
} else {
/*
* no args. show available properties
*/
if (argc == 0) {
PROP_META[0].resetWidth();
PROP_META[1].resetWidth();
final TableRenderer table = new TableRenderer(PROP_META, HenPlus.out());
for (Map.Entry<String, PropertyHolder> entry : getRegistry().getPropertyMap().entrySet()) {
final Column[] row = new Column[3];
final PropertyHolder holder = entry.getValue();
row[0] = new Column(entry.getKey());
row[1] = new Column(holder.getValue());
row[2] = new Column(holder.getShortDescription());
table.addRow(row);
}
table.closeTable();
return SUCCESS;
} else if (argc == 1) {
/*
* one arg: show help
*/
final String name = st.nextToken();
PropertyHolder holder;
holder = getRegistry().getPropertyMap().get(name);
if (holder == null) {
return EXEC_FAILED;
}
printDescription(name, holder);