This repository was archived by the owner on Jun 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/dev/alangomes/springspigot/picocli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Spring Boot Spigot Starter
22
33[ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg )] ( https://github.com/Alan-Gomes/mcspring-boot/fork )
4- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/dev.alangomes/spigot-spring-boot-starter.svg )] ( https://search.maven.org/#artifactdetails%7Cdev.alangomes%7Cspigot-spring-boot-starter%7C0.11.0 %7Cjar )
4+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/dev.alangomes/spigot-spring-boot-starter.svg )] ( https://search.maven.org/#artifactdetails%7Cdev.alangomes%7Cspigot-spring-boot-starter%7C0.11.1 %7Cjar )
55[ ![ License] ( https://img.shields.io/github/license/Alan-Gomes/mcspring-boot.svg?style=popout )] ( https://github.com/Alan-Gomes/mcspring-boot/blob/master/LICENSE )
66[ ![ Coverage Status] ( https://img.shields.io/coveralls/github/Alan-Gomes/mcspring-boot/master.svg )] ( https://coveralls.io/github/Alan-Gomes/mcspring-boot?branch=master )
77[ ![ GitHub Issues] ( https://img.shields.io/github/issues/Alan-Gomes/mcspring-boot.svg )] ( https://github.com/Alan-Gomes/mcspring-boot/issues )
@@ -29,7 +29,7 @@ Add the Spring boot starter to your project
2929<dependency >
3030 <groupId >dev.alangomes</groupId >
3131 <artifactId >spigot-spring-boot-starter</artifactId >
32- <version >0.11.0 </version >
32+ <version >0.11.1 </version >
3333</dependency >
3434```
3535
Original file line number Diff line number Diff line change 99 <groupId >dev.alangomes</groupId >
1010 <artifactId >spigot-spring-boot-starter</artifactId >
1111 <packaging >jar</packaging >
12- <version >0.11.0 </version >
12+ <version >0.11.1 </version >
1313 <description >Spring support for spigot plugins</description >
1414 <url >https://github.com/Alan-Gomes/mcspring-boot</url >
1515
Original file line number Diff line number Diff line change 66import org .springframework .aop .support .AopUtils ;
77import org .springframework .beans .factory .BeanFactory ;
88import picocli .CommandLine ;
9+ import picocli .CommandLine .IHelpSectionRenderer ;
910
1011import java .util .Collections ;
1112import java .util .HashMap ;
13+ import java .util .Map ;
1214import java .util .Set ;
15+ import java .util .function .Function ;
16+ import java .util .stream .Collectors ;
1317
1418@ Getter
1519public class CommandLineDefinition {
@@ -42,6 +46,8 @@ public CommandLine build(BeanFactory factory) {
4246 commandLine .addSubcommand (key , value );
4347 }
4448 });
49+
50+ overrideHelpRenderers (commandLine );
4551 return commandLine ;
4652 }
4753
@@ -58,4 +64,16 @@ public Set<String> getCommandNames() {
5864 return Collections .unmodifiableSet (subcommands .keySet ());
5965 }
6066
67+ private void overrideHelpRenderers (CommandLine commandLine ) {
68+ Map <String , IHelpSectionRenderer > renderers = commandLine .getHelpSectionMap ().keySet ()
69+ .stream ()
70+ .collect (Collectors .toMap (Function .identity (), (k ) -> overrideRenderer (commandLine .getHelpSectionMap ().get (k ))));
71+ commandLine .setHelpSectionMap (renderers );
72+ }
73+
74+ private IHelpSectionRenderer overrideRenderer (IHelpSectionRenderer renderer ) {
75+ // strip carriage returns when running inside a windows server
76+ return (h ) -> renderer .render (h ).replaceAll ("\\ r" , "" );
77+ }
78+
6179}
You can’t perform that action at this time.
0 commit comments