use of com.eden.orchid.api.options.OrchidOption in project Orchid by JavaEden.
the class Orchid method findOptions.
public static List<OrchidOption> findOptions() {
if (Orchid.orchidOptions == null) {
Orchid.orchidOptions = new ArrayList<>();
FastClasspathScanner scanner = new FastClasspathScanner();
scanner.matchSubclassesOf(OrchidOption.class, (matchingClass) -> {
try {
OrchidOption option = matchingClass.newInstance();
if (option != null) {
Orchid.orchidOptions.add(option);
}
} catch (Exception e) {
e.printStackTrace();
}
});
scanner.scan();
}
return Orchid.orchidOptions;
}
use of com.eden.orchid.api.options.OrchidOption in project Orchid by JavaEden.
the class ListOptionsTask method run.
@Override
public void run() {
Clog.logger(OrchidTasks.loggerKey, "" + "#{ $0 | fg('cyan') }[Priority]#{$0 |reset}" + "#{ $0 | fg('magenta') }[Flag]#{$0 |reset}" + "#{ $0 | fg('yellow') }[OrchidOption Length]#{$0 |reset}");
Clog.logger(OrchidTasks.loggerKey, "------------------------------------------------------------------------------------");
Clog.logger(OrchidTasks.loggerKey, "------------------------------------------------------------------------------------");
for (OrchidOption option : options) {
if (option.optionLength() > 0) {
Clog.logger(OrchidTasks.loggerKey, "" + "#{ $0 | fg('cyan') }[#{$1}]#{$0 |reset}" + "#{ $0 | fg('magenta') }[#{$2}]#{$0 |reset}" + "#{ $0 | fg('yellow') }[#{$3}]#{$0 |reset}", new Object[] { option.getPriority(), "-" + option.getFlag(), option.optionLength() + " parameters" });
for (String line : OrchidUtils.wrapString(option.getDescription(), 80)) {
Clog.logger(OrchidTasks.loggerKey, " " + line);
}
Clog.logger(OrchidTasks.loggerKey, " --------------------------------------------------------------------------------");
Clog.logger(OrchidTasks.loggerKey, "");
}
}
}
Aggregations