use of act.Act in project actframework by actframework.
the class CliDispatcher method commands.
/**
* Returns all commands in alphabetic order
*
* @return the list of commands
*/
public List<String> commands(boolean sys, boolean app) {
C.List<String> list = C.newList();
Act.Mode mode = Act.mode();
boolean all = !sys && !app;
for (String s : registry.keySet()) {
boolean isSysCmd = s.startsWith("act.");
if (isSysCmd && !sys && !all) {
continue;
}
if (!isSysCmd && !app && !all) {
continue;
}
CliHandler h = registry.get(s);
if (h.appliedIn(mode)) {
list.add(s);
}
}
return list.sorted(new Osgl.Comparator<String>() {
@Override
public int compare(String o1, String o2) {
boolean b1 = (o1.startsWith("act."));
boolean b2 = (o2.startsWith("act."));
if (b1 & !b2) {
return -1;
}
if (!b1 & b2) {
return 1;
}
return o1.compareTo(o2);
}
});
}
use of act.Act in project actframework by actframework.
the class CliDispatcher method handler.
public CliHandler handler(String command) {
String command0 = command;
command = shortCuts.get(command);
if (null == command) {
command = command0;
}
CliHandler handler = registry.get(command);
if (null == handler && !command.startsWith("act.")) {
handler = registry.get("act." + command);
}
Act.Mode mode = Act.mode();
if (null != handler && handler.appliedIn(mode)) {
return handler;
}
return null;
}
Aggregations