/** * Shellifies a command name * * @param name * @return */ public static String shellifyCommandName(String name) { return Commands.shellifyCommandName(name); }
@Override public void initializeUI(UIBuilder builder) throws Exception { springBootVersion.setValueChoices(Arrays.asList(SPRING_BOOT_VERSIONS)); springBootVersion.setDefaultValue(SPRING_BOOT_DEFAULT_VERSION); try { choices = initDependencies(); } catch (Exception e) { throw new IllegalStateException("Error loading dependencies from spring-boot-application.yaml due: " + e.getMessage(), e); } dependencies.setValueChoices(choices); if (builder.getUIContext().getProvider().isGUI()) { dependencies.setItemLabelConverter(SpringBootDependencyDTO::getGroupAndName); } else { // if in CLI mode then use shorter names so they are tab friendly in the shell dependencies.setItemLabelConverter(dto -> Commands.shellifyCommandName(dto.getName())); } dependencies.setValueConverter(s -> { for (SpringBootDependencyDTO dto : choices) { if (dto.getId().equals(s)) { return dto; } } return null; }); builder.add(springBootVersion).add(dependencies); }
dto -> Commands.shellifyCommandName(dto.getName()));