Skip to content

Commit b42fb05

Browse files
committed
[#2028][#2031] Add setter for name in picocli.shell.jline3.PicocliCommands
1 parent 0bebcc5 commit b42fb05

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

RELEASE-NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).
2121

2222
See fixed items below.
2323

24+
I cheated on the semantic versioning in this release: a public setter method was added in a class in the `picocli.shell.jline3` module. In spite of that, the version number went from 4.7.3 to 4.7.4 (not 4.8.0). My apologies.
25+
2426

2527
## <a name="4.7.4-fixes"></a> Fixed issues
28+
* [#2028][#2031] API: Add setter for name in `picocli.shell.jline3.PicocliCommands`. Thanks to [Irina Leontyuk](https://github.com/irinaleo) for raising this.
2629
* [#2026][#2027] Enhancement: Improved feedback on mistyped subcommands. Thanks to [David Pond](https://github.com/mauvo) for the pull request.
2730
* [#2029][#2034] Enhancement: prevent `java.nio.charset.UnsupportedCharsetException: cp0` on windows, and fall back to the default charset if the charset provided by System property `sun.stdout.encoding` is invalid. Thanks to [
2831
Bartosz Spyrko-Smietanko](https://github.com/spyrkob) for the pull request.

picocli-shell-jline3/src/main/java/picocli/shell/jline3/PicocliCommands.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* @since 4.1.2
4242
*/
4343
public class PicocliCommands implements CommandRegistry {
44+
private String picocliCommandsName;
4445

4546
/**
4647
* Command that clears the screen.
@@ -307,4 +308,25 @@ public Map<String, String> commandAliases() {
307308
public CmdDesc commandDescription(String command) {
308309
return null;
309310
}
311+
312+
/**
313+
* Returns the name shown for this collection of picocli commands in the usage help message.
314+
* If not set with {@link #name(String)}, this returns {@link CommandRegistry#name()}.
315+
* @return the name shown for this collection of picocli commands in the usage help message
316+
*/
317+
@Override
318+
public String name() {
319+
if (picocliCommandsName != null) {
320+
return picocliCommandsName;
321+
}
322+
return CommandRegistry.super.name();
323+
}
324+
325+
/**
326+
* Sets the name shown for this collection of picocli commands in the usage help message.
327+
* @param newName the new name to show
328+
*/
329+
public void name(String newName) {
330+
picocliCommandsName = newName;
331+
}
310332
}

0 commit comments

Comments
 (0)