use of io.github.ihongs.cmdlet.anno.Cmdlet in project HongsCORE by ihongs.
the class CoreRoster method addServ.
private static void addServ(Map<String, Mathod> acts, Map<String, Method> cmds, String... pkgs) {
for (String pkgn : pkgs) {
pkgn = pkgn.trim();
if (pkgn.length() == 0) {
continue;
}
Set<String> clss = getClss(pkgn);
for (String clsn : clss) {
Class clso = getClso(clsn);
// 从注解提取动作名
Action acto = (Action) clso.getAnnotation(Action.class);
if (acto != null) {
addActs(acts, acto, clsn, clso);
continue;
}
Cmdlet cmdo = (Cmdlet) clso.getAnnotation(Cmdlet.class);
if (cmdo != null) {
addCmds(cmds, cmdo, clsn, clso);
}
}
}
}
use of io.github.ihongs.cmdlet.anno.Cmdlet in project HongsCORE by ihongs.
the class Common method showENV.
@Cmdlet("show-env")
public static void showENV(String[] args) {
Map<String, String> a = new TreeMap(new PropComparator());
Map<String, String> m = new HashMap(System.getenv());
int i = 0, j;
for (Map.Entry<String, String> et : m.entrySet()) {
String k = et.getKey();
String v = et.getValue();
a.put(k, v);
j = k.length();
if (i < j && j < 39) {
i = j;
}
}
PrintStream out = CmdletHelper.OUT.get();
for (Map.Entry<String, String> n : a.entrySet()) {
StringBuilder s = new StringBuilder();
s.append(n.getKey());
for (j = n.getKey().length(); j < i; j++) {
s.append(" ");
}
s.append("\t");
s.append(n.getValue());
out.println(s);
}
}
use of io.github.ihongs.cmdlet.anno.Cmdlet in project HongsCORE by ihongs.
the class Common method echo.
@Cmdlet("echo")
public static void echo(String[] args) {
PrintStream out = CmdletHelper.OUT.get();
for (String arg : args) {
out.print(arg);
out.print(" ");
}
out.println();
}
Aggregations