public static void main(String[] args) throws Exception {
new AliasCommand().execute(args);
}
public void execute() throws Exception {
final AliasManager aliasMgr = ShellUtils.getCurrentAliasManager();
if (argRemove.isSet()) {
// remove an alias
aliasMgr.remove(argRemove.getValue());
} else if (argAlias.isSet()) {
// add an alias
String className = argClass.getValue();
try {
// If the className argument is actually an existing alias, use
// the existing alias's class name as the new alias's class name.
String tmp = aliasMgr.getAliasClassName(className);
if (tmp != null) {
className = tmp;
}
} catch (NoSuchAliasException e) {
// ignore
}
aliasMgr.add(argAlias.getValue(), className);
} else {
// list the aliases
showAliases(aliasMgr, getOutput().getPrintWriter());
}
}