Skip to content

Commit

Permalink
添加子指令usage自定义逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
p-moon committed Aug 1, 2022
1 parent 6f3f247 commit 2c9c230
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>plus.jdk</groupId>
<artifactId>cli-plus</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For detailed instructions, see: https://jdk.plus/pages/2ba02f/
<dependency>
<groupId>plus.jdk</groupId>
<artifactId>cli-plus</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>plus.jdk</groupId>
<artifactId>cli-plus</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
<name>cli-plus</name>
<description>一款编写命令行指令集的java工具库</description>
<url>https://github.com/JDK-Plus/cli-plus</url>
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/plus/jdk/cli/JCommandLinePlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;
import plus.jdk.cli.annotation.CommandLinePlus;
import plus.jdk.cli.annotation.CommandParameter;
import plus.jdk.cli.annotation.SubInstruction;
Expand Down Expand Up @@ -187,10 +188,17 @@ protected void showUsage() throws IllegalAccessException {
while (builder.length() < maxArgsInfoLen) {
builder.append(" ");
}
println("\t\t", builder.toString(), " ", argHelpInfo.getArgHelpInfo());
println("\t ", builder.toString(), " ", argHelpInfo.getArgHelpInfo());
}
if(commandLinePlus != null && StringUtils.hasText(commandLinePlus.usage())) {
println("\t", commandLinePlus.usage());
}
if(StringUtils.hasText(cliHelpModel.getFooterDesc())) {
println("\t", cliHelpModel.getFooterDesc());
}
if(StringUtils.hasText(cliHelpModel.getFooterContact())) {
println("\t", cliHelpModel.getFooterContact());
}
println("\t", cliHelpModel.getFooterDesc());
println("\t", cliHelpModel.getFooterContact());
}

protected void println(String... contents) {
Expand Down

0 comments on commit 2c9c230

Please sign in to comment.