private static AeshCommandContainer doGenerateCommandLineParser(Object commandObject,
boolean clazzIsaCommand, boolean isChild) throws CommandLineParserException {
Class clazz = commandObject.getClass();
CommandDefinition command = (CommandDefinition) clazz.getAnnotation(CommandDefinition.class);
if(command != null) {
ProcessedCommand processedCommand = new ProcessedCommandBuilder()
.name(command.name())
.description(command.description())
.validator(command.validator())
.resultHandler(command.resultHandler()).create();
processCommand(processedCommand, clazz);
if(clazzIsaCommand)
return new AeshCommandContainer(
new CommandLineParserBuilder()
.processedCommand(processedCommand)
.command((Command) commandObject)
.create());
else
return new AeshCommandContainer(
new CommandLineParserBuilder()
.processedCommand(processedCommand)
.create());
}
GroupCommandDefinition groupCommand = (GroupCommandDefinition) clazz.getAnnotation(GroupCommandDefinition.class);
if(groupCommand != null) {
ProcessedCommand processedGroupCommand = new ProcessedCommandBuilder()
.name(groupCommand.name())
.description(groupCommand.description())
.validator(groupCommand.validator())
.resultHandler(groupCommand.resultHandler())
.create();